@staff0rd/assist 0.1112.1 → 0.1112.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/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.1112.
|
|
9
|
+
version: "0.1112.2",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -186,10 +186,10 @@ function sweepStagedAttachments(dir = stagedAttachmentsDir, now = Date.now()) {
|
|
|
186
186
|
}
|
|
187
187
|
for (const name2 of entries) {
|
|
188
188
|
if (!name2.startsWith("upload-")) continue;
|
|
189
|
-
const
|
|
189
|
+
const path115 = join2(dir, name2);
|
|
190
190
|
try {
|
|
191
|
-
if (now - statSync(
|
|
192
|
-
rmSync(
|
|
191
|
+
if (now - statSync(path115).mtimeMs > PANE_PERSIST_TTL_MS)
|
|
192
|
+
rmSync(path115, { recursive: true, force: true });
|
|
193
193
|
} catch {
|
|
194
194
|
}
|
|
195
195
|
}
|
|
@@ -1021,9 +1021,9 @@ var assistConfigSchema = z6.strictObject({
|
|
|
1021
1021
|
});
|
|
1022
1022
|
|
|
1023
1023
|
// src/shared/dropUnknownConfigKeys.ts
|
|
1024
|
-
function objectAt(root2,
|
|
1024
|
+
function objectAt(root2, path115) {
|
|
1025
1025
|
let node = root2;
|
|
1026
|
-
for (const segment of
|
|
1026
|
+
for (const segment of path115) {
|
|
1027
1027
|
if (!node || typeof node !== "object") return void 0;
|
|
1028
1028
|
node = node[segment];
|
|
1029
1029
|
}
|
|
@@ -1075,9 +1075,9 @@ function findGitLink(dir) {
|
|
|
1075
1075
|
}
|
|
1076
1076
|
return null;
|
|
1077
1077
|
}
|
|
1078
|
-
function isFile(
|
|
1078
|
+
function isFile(path115) {
|
|
1079
1079
|
try {
|
|
1080
|
-
return statSync3(
|
|
1080
|
+
return statSync3(path115).isFile();
|
|
1081
1081
|
} catch {
|
|
1082
1082
|
return false;
|
|
1083
1083
|
}
|
|
@@ -1096,9 +1096,9 @@ function linkedGitDirParent(gitDir) {
|
|
|
1096
1096
|
const match = /^(.*)[/\\]worktrees[/\\][^/\\]+[/\\]?$/.exec(gitDir);
|
|
1097
1097
|
return match ? match[1] : null;
|
|
1098
1098
|
}
|
|
1099
|
-
function readTrimmed(
|
|
1099
|
+
function readTrimmed(path115) {
|
|
1100
1100
|
try {
|
|
1101
|
-
const content = readFileSync(
|
|
1101
|
+
const content = readFileSync(path115, "utf8").trim();
|
|
1102
1102
|
return content === "" ? null : content;
|
|
1103
1103
|
} catch {
|
|
1104
1104
|
return null;
|
|
@@ -1111,10 +1111,10 @@ function absolute(target, from) {
|
|
|
1111
1111
|
// src/shared/loadRawYaml.ts
|
|
1112
1112
|
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
1113
1113
|
import { parse as parseYaml } from "yaml";
|
|
1114
|
-
function loadRawYaml(
|
|
1115
|
-
if (!existsSync2(
|
|
1114
|
+
function loadRawYaml(path115) {
|
|
1115
|
+
if (!existsSync2(path115)) return {};
|
|
1116
1116
|
try {
|
|
1117
|
-
const content = readFileSync2(
|
|
1117
|
+
const content = readFileSync2(path115, "utf8");
|
|
1118
1118
|
return parseYaml(content) || {};
|
|
1119
1119
|
} catch {
|
|
1120
1120
|
return {};
|
|
@@ -1216,10 +1216,10 @@ function getStorePath(filename) {
|
|
|
1216
1216
|
return join5(getStoreDir(), filename);
|
|
1217
1217
|
}
|
|
1218
1218
|
function loadJson(filename) {
|
|
1219
|
-
const
|
|
1220
|
-
if (existsSync3(
|
|
1219
|
+
const path115 = getStorePath(filename);
|
|
1220
|
+
if (existsSync3(path115)) {
|
|
1221
1221
|
try {
|
|
1222
|
-
return JSON.parse(readFileSync3(
|
|
1222
|
+
return JSON.parse(readFileSync3(path115, "utf8"));
|
|
1223
1223
|
} catch {
|
|
1224
1224
|
return {};
|
|
1225
1225
|
}
|
|
@@ -1231,11 +1231,11 @@ function saveJson(filename, data) {
|
|
|
1231
1231
|
if (!existsSync3(dir)) {
|
|
1232
1232
|
mkdirSync2(dir, { recursive: true });
|
|
1233
1233
|
}
|
|
1234
|
-
const
|
|
1235
|
-
const tmp = `${
|
|
1234
|
+
const path115 = getStorePath(filename);
|
|
1235
|
+
const tmp = `${path115}.${process.pid}.tmp`;
|
|
1236
1236
|
try {
|
|
1237
1237
|
writeFileSync(tmp, JSON.stringify(data, null, 2));
|
|
1238
|
-
renameSync(tmp,
|
|
1238
|
+
renameSync(tmp, path115);
|
|
1239
1239
|
} catch (error) {
|
|
1240
1240
|
rmSync2(tmp, { force: true });
|
|
1241
1241
|
throw error;
|
|
@@ -1247,10 +1247,10 @@ function repoConfigCachePath() {
|
|
|
1247
1247
|
return join6(getStoreDir(), "repo-config-cache.json");
|
|
1248
1248
|
}
|
|
1249
1249
|
function readConfigCacheFile() {
|
|
1250
|
-
const
|
|
1251
|
-
if (!existsSync4(
|
|
1250
|
+
const path115 = repoConfigCachePath();
|
|
1251
|
+
if (!existsSync4(path115)) return {};
|
|
1252
1252
|
try {
|
|
1253
|
-
const parsed = JSON.parse(readFileSync4(
|
|
1253
|
+
const parsed = JSON.parse(readFileSync4(path115, "utf8"));
|
|
1254
1254
|
return parsed ?? {};
|
|
1255
1255
|
} catch {
|
|
1256
1256
|
return {};
|
|
@@ -1317,8 +1317,8 @@ function getRemoteOriginUrl(cwd) {
|
|
|
1317
1317
|
|
|
1318
1318
|
// src/commands/backlog/getCurrentOrigin.ts
|
|
1319
1319
|
var WINDOWS_PATH = /^[A-Za-z]:[\\/]/;
|
|
1320
|
-
function stripLeadingSlashes(
|
|
1321
|
-
return
|
|
1320
|
+
function stripLeadingSlashes(path115) {
|
|
1321
|
+
return path115.replace(/^\/+/, "");
|
|
1322
1322
|
}
|
|
1323
1323
|
function normalizeOrigin(raw) {
|
|
1324
1324
|
const trimmed = raw.trim().replace(/\.git$/i, "").replace(/\/+$/, "");
|
|
@@ -1361,8 +1361,8 @@ function getCachedOrigin(cwd) {
|
|
|
1361
1361
|
// src/commands/backlog/originDisplayName.ts
|
|
1362
1362
|
function originDisplayName(origin) {
|
|
1363
1363
|
if (origin.startsWith("local:")) {
|
|
1364
|
-
const
|
|
1365
|
-
const segments =
|
|
1364
|
+
const path115 = origin.slice("local:".length).replace(/\/+$/, "");
|
|
1365
|
+
const segments = path115.split("/").filter(Boolean);
|
|
1366
1366
|
return segments[segments.length - 1] ?? origin;
|
|
1367
1367
|
}
|
|
1368
1368
|
const firstSlash = origin.indexOf("/");
|
|
@@ -2632,9 +2632,9 @@ var LOCAL_FILES = ["backlog.jsonl", "backlog.db"];
|
|
|
2632
2632
|
function backupLocalBacklogFiles(dir) {
|
|
2633
2633
|
const moved = [];
|
|
2634
2634
|
for (const name2 of LOCAL_FILES) {
|
|
2635
|
-
const
|
|
2636
|
-
if (existsSync9(
|
|
2637
|
-
renameSync2(
|
|
2635
|
+
const path115 = join9(dir, ".assist", name2);
|
|
2636
|
+
if (existsSync9(path115)) {
|
|
2637
|
+
renameSync2(path115, `${path115}.bak`);
|
|
2638
2638
|
moved.push(`${name2} \u2192 ${name2}.bak`);
|
|
2639
2639
|
}
|
|
2640
2640
|
}
|
|
@@ -3085,8 +3085,8 @@ var backlogItemSchema = z7.strictObject({
|
|
|
3085
3085
|
var backlogFileSchema = z7.array(backlogItemSchema);
|
|
3086
3086
|
|
|
3087
3087
|
// src/commands/backlog/parseBacklogJsonl.ts
|
|
3088
|
-
function parseBacklogJsonl(
|
|
3089
|
-
const content = readFileSync5(
|
|
3088
|
+
function parseBacklogJsonl(path115) {
|
|
3089
|
+
const content = readFileSync5(path115, "utf8").trim();
|
|
3090
3090
|
if (content.length === 0) return [];
|
|
3091
3091
|
return content.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => backlogItemSchema.parse(JSON.parse(line)));
|
|
3092
3092
|
}
|
|
@@ -4812,10 +4812,10 @@ function completeLines(text19, windowIsPartial) {
|
|
|
4812
4812
|
if (windowIsPartial) all.shift();
|
|
4813
4813
|
return all;
|
|
4814
4814
|
}
|
|
4815
|
-
function readLogTail(
|
|
4815
|
+
function readLogTail(path115, lines) {
|
|
4816
4816
|
let fd;
|
|
4817
4817
|
try {
|
|
4818
|
-
fd = openSync2(
|
|
4818
|
+
fd = openSync2(path115, "r");
|
|
4819
4819
|
} catch {
|
|
4820
4820
|
return [];
|
|
4821
4821
|
}
|
|
@@ -5162,10 +5162,10 @@ var hooksSettings = {
|
|
|
5162
5162
|
}
|
|
5163
5163
|
};
|
|
5164
5164
|
function ensureHooksSettings() {
|
|
5165
|
-
const
|
|
5166
|
-
mkdirSync3(dirname5(
|
|
5167
|
-
writeFileSync3(
|
|
5168
|
-
return
|
|
5165
|
+
const path115 = daemonPaths.hooksSettings;
|
|
5166
|
+
mkdirSync3(dirname5(path115), { recursive: true });
|
|
5167
|
+
writeFileSync3(path115, JSON.stringify(hooksSettings, null, 2));
|
|
5168
|
+
return path115;
|
|
5169
5169
|
}
|
|
5170
5170
|
|
|
5171
5171
|
// src/commands/sessions/daemon/spawnPty.ts
|
|
@@ -5986,12 +5986,12 @@ function claudeToolOperations({
|
|
|
5986
5986
|
return paths.length ? [{ kind: "fileRead", tool: toolName, paths }] : [];
|
|
5987
5987
|
}
|
|
5988
5988
|
if (WRITE_TOOLS.has(toolName)) {
|
|
5989
|
-
const [
|
|
5990
|
-
return
|
|
5989
|
+
const [path115] = strings([toolInput.file_path, toolInput.notebook_path]);
|
|
5990
|
+
return path115 ? [
|
|
5991
5991
|
{
|
|
5992
5992
|
kind: "fileWrite",
|
|
5993
5993
|
tool: toolName,
|
|
5994
|
-
path:
|
|
5994
|
+
path: path115,
|
|
5995
5995
|
contents: incomingContents(toolInput)
|
|
5996
5996
|
}
|
|
5997
5997
|
] : [];
|
|
@@ -7444,13 +7444,13 @@ function record2(value) {
|
|
|
7444
7444
|
return value && typeof value === "object" ? value : {};
|
|
7445
7445
|
}
|
|
7446
7446
|
function fileWrites(changes) {
|
|
7447
|
-
return Object.entries(changes).flatMap(([
|
|
7447
|
+
return Object.entries(changes).flatMap(([path115, change]) => {
|
|
7448
7448
|
const { content, move_path: movePath } = record2(change);
|
|
7449
7449
|
const contents = typeof content === "string" ? [content] : [];
|
|
7450
7450
|
const write2 = {
|
|
7451
7451
|
kind: "fileWrite",
|
|
7452
7452
|
tool: "apply_patch",
|
|
7453
|
-
path:
|
|
7453
|
+
path: path115,
|
|
7454
7454
|
contents
|
|
7455
7455
|
};
|
|
7456
7456
|
return typeof movePath === "string" ? [write2, { ...write2, path: movePath }] : [write2];
|
|
@@ -7557,8 +7557,8 @@ function parseApplyPatch(patch2) {
|
|
|
7557
7557
|
}
|
|
7558
7558
|
if (added && line.startsWith("+")) added.push(line.slice(1));
|
|
7559
7559
|
}
|
|
7560
|
-
return files.map(({ path:
|
|
7561
|
-
path:
|
|
7560
|
+
return files.map(({ path: path115, added: lines }) => ({
|
|
7561
|
+
path: path115,
|
|
7562
7562
|
contents: lines.length ? [lines.join("\n")] : []
|
|
7563
7563
|
}));
|
|
7564
7564
|
}
|
|
@@ -7579,10 +7579,10 @@ function patchText(input) {
|
|
|
7579
7579
|
);
|
|
7580
7580
|
}
|
|
7581
7581
|
function patchWrites(tool, patch2) {
|
|
7582
|
-
return parseApplyPatch(patch2).map(({ path:
|
|
7582
|
+
return parseApplyPatch(patch2).map(({ path: path115, contents }) => ({
|
|
7583
7583
|
kind: "fileWrite",
|
|
7584
7584
|
tool,
|
|
7585
|
-
path:
|
|
7585
|
+
path: path115,
|
|
7586
7586
|
contents
|
|
7587
7587
|
}));
|
|
7588
7588
|
}
|
|
@@ -7601,10 +7601,10 @@ function codexToolOperations({
|
|
|
7601
7601
|
if (!PATCH_TOOLS.has(toolName)) return [];
|
|
7602
7602
|
const patch2 = patchText(toolInput);
|
|
7603
7603
|
if (patch2) return patchWrites(toolName, patch2);
|
|
7604
|
-
const { file_path:
|
|
7605
|
-
if (typeof
|
|
7604
|
+
const { file_path: path115, content } = toolInput;
|
|
7605
|
+
if (typeof path115 !== "string") return [];
|
|
7606
7606
|
const contents = typeof content === "string" ? [content] : [];
|
|
7607
|
-
return [{ kind: "fileWrite", tool: toolName, path:
|
|
7607
|
+
return [{ kind: "fileWrite", tool: toolName, path: path115, contents }];
|
|
7608
7608
|
}
|
|
7609
7609
|
|
|
7610
7610
|
// src/shared/harnessAdapters/codexToolEvents.ts
|
|
@@ -7673,8 +7673,8 @@ var codexConversationReader = {
|
|
|
7673
7673
|
headBytes: 2 * 1024 * 1024,
|
|
7674
7674
|
locate: ({ harnessSessionId }) => harnessSessionId ? findCodexRolloutPathSync(harnessSessionId) : null,
|
|
7675
7675
|
watchTarget: (ref) => {
|
|
7676
|
-
const
|
|
7677
|
-
return
|
|
7676
|
+
const path115 = codexConversationReader.locate(ref);
|
|
7677
|
+
return path115 ? { dir: dirname8(path115), file: basename6(path115) } : null;
|
|
7678
7678
|
},
|
|
7679
7679
|
events: (entries) => entries.flatMap(entryEvents),
|
|
7680
7680
|
lifecycle: (entries) => ({
|
|
@@ -8151,15 +8151,15 @@ function piToolOperations({
|
|
|
8151
8151
|
const command = stringField(toolInput, "command")?.trim();
|
|
8152
8152
|
return command ? [{ kind: "command", tool: commandTool, command }] : [];
|
|
8153
8153
|
}
|
|
8154
|
-
const
|
|
8154
|
+
const path115 = stringField(toolInput, "path", "file_path", "pattern");
|
|
8155
8155
|
if (READ_TOOLS2.has(name2))
|
|
8156
|
-
return
|
|
8157
|
-
if (WRITE_TOOLS2.has(name2) &&
|
|
8156
|
+
return path115 ? [{ kind: "fileRead", tool: toolName, paths: [path115] }] : [];
|
|
8157
|
+
if (WRITE_TOOLS2.has(name2) && path115)
|
|
8158
8158
|
return [
|
|
8159
8159
|
{
|
|
8160
8160
|
kind: "fileWrite",
|
|
8161
8161
|
tool: toolName,
|
|
8162
|
-
path:
|
|
8162
|
+
path: path115,
|
|
8163
8163
|
contents: incomingContents2(toolInput)
|
|
8164
8164
|
}
|
|
8165
8165
|
];
|
|
@@ -8383,8 +8383,8 @@ async function loadCommittedPaths(cwd, session) {
|
|
|
8383
8383
|
for (const commit2 of commits2) {
|
|
8384
8384
|
const resolved = await resolveCommit(cwd, commit2.sha);
|
|
8385
8385
|
if (!resolved) continue;
|
|
8386
|
-
for (const
|
|
8387
|
-
if (!bases.has(
|
|
8386
|
+
for (const path115 of resolved.paths) {
|
|
8387
|
+
if (!bases.has(path115)) bases.set(path115, resolved.base);
|
|
8388
8388
|
}
|
|
8389
8389
|
}
|
|
8390
8390
|
return { commits: commits2, bases };
|
|
@@ -8430,16 +8430,16 @@ async function itemChangeSet(cwd, session) {
|
|
|
8430
8430
|
}
|
|
8431
8431
|
function groupByBase(bases) {
|
|
8432
8432
|
const groups = /* @__PURE__ */ new Map();
|
|
8433
|
-
for (const [
|
|
8433
|
+
for (const [path115, base] of bases) {
|
|
8434
8434
|
const paths = groups.get(base);
|
|
8435
|
-
if (paths) paths.push(
|
|
8436
|
-
else groups.set(base, [
|
|
8435
|
+
if (paths) paths.push(path115);
|
|
8436
|
+
else groups.set(base, [path115]);
|
|
8437
8437
|
}
|
|
8438
8438
|
return [...groups].map(([base, paths]) => ({ base, paths: paths.sort() }));
|
|
8439
8439
|
}
|
|
8440
8440
|
async function dirtyPaths(cwd, bases) {
|
|
8441
8441
|
const output = await execGit(cwd, ["diff", "--name-only", "HEAD"]);
|
|
8442
|
-
return output.split("\n").filter((
|
|
8442
|
+
return output.split("\n").filter((path115) => path115 && !bases.has(path115)).sort();
|
|
8443
8443
|
}
|
|
8444
8444
|
|
|
8445
8445
|
// src/commands/sessions/web/scopedDiff.ts
|
|
@@ -8448,8 +8448,8 @@ async function scopedDiff(cwd, session, scope) {
|
|
|
8448
8448
|
if (scope.kind === "commit") return commitDiff(cwd, scope.sha);
|
|
8449
8449
|
return await trackedScopeDiff(cwd, session, scope) + await untrackedDiff(cwd);
|
|
8450
8450
|
}
|
|
8451
|
-
async function untrackedFileDiff(cwd,
|
|
8452
|
-
return execGit(cwd, ["diff", "--no-index", "--", "/dev/null",
|
|
8451
|
+
async function untrackedFileDiff(cwd, path115) {
|
|
8452
|
+
return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path115], {
|
|
8453
8453
|
maxBuffer: MAX_DIFF_BYTES,
|
|
8454
8454
|
allowFailure: true
|
|
8455
8455
|
});
|
|
@@ -8462,7 +8462,7 @@ async function untrackedDiff(cwd) {
|
|
|
8462
8462
|
]);
|
|
8463
8463
|
const paths = list7.split("\n").filter(Boolean);
|
|
8464
8464
|
const diffs = await Promise.all(
|
|
8465
|
-
paths.map((
|
|
8465
|
+
paths.map((path115) => untrackedFileDiff(cwd, path115))
|
|
8466
8466
|
);
|
|
8467
8467
|
return diffs.join("");
|
|
8468
8468
|
}
|
|
@@ -8673,9 +8673,9 @@ import { isAbsolute as isAbsolute2, relative, resolve as resolve4 } from "path";
|
|
|
8673
8673
|
function repoRoot2(cwd) {
|
|
8674
8674
|
return resolve4(cwd);
|
|
8675
8675
|
}
|
|
8676
|
-
function resolveWithinCwd(cwd,
|
|
8676
|
+
function resolveWithinCwd(cwd, path115) {
|
|
8677
8677
|
const root2 = repoRoot2(cwd);
|
|
8678
|
-
const target = resolve4(root2,
|
|
8678
|
+
const target = resolve4(root2, path115);
|
|
8679
8679
|
const rel = relative(root2, target);
|
|
8680
8680
|
if (rel === "" || rel.startsWith("..") || isAbsolute2(rel)) return null;
|
|
8681
8681
|
return target;
|
|
@@ -8685,14 +8685,14 @@ function resolveWithinCwd(cwd, path114) {
|
|
|
8685
8685
|
function getFileTarget(req, res) {
|
|
8686
8686
|
const cwd = getCwdParam(req, res);
|
|
8687
8687
|
if (!cwd) return null;
|
|
8688
|
-
const
|
|
8688
|
+
const path115 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
|
|
8689
8689
|
"path"
|
|
8690
8690
|
);
|
|
8691
|
-
if (!
|
|
8691
|
+
if (!path115) {
|
|
8692
8692
|
respondJson(res, 400, { error: "Missing path" });
|
|
8693
8693
|
return null;
|
|
8694
8694
|
}
|
|
8695
|
-
const target = resolveWithinCwd(cwd,
|
|
8695
|
+
const target = resolveWithinCwd(cwd, path115);
|
|
8696
8696
|
if (!target) {
|
|
8697
8697
|
respondJson(res, 400, { error: "Path outside cwd" });
|
|
8698
8698
|
return null;
|
|
@@ -9249,9 +9249,9 @@ function segmentText(segment) {
|
|
|
9249
9249
|
if (segment.kind === "index") return `[${segment.index}]`;
|
|
9250
9250
|
return "[]";
|
|
9251
9251
|
}
|
|
9252
|
-
function formatConfigPath(
|
|
9252
|
+
function formatConfigPath(path115) {
|
|
9253
9253
|
let text19 = "";
|
|
9254
|
-
for (const segment of
|
|
9254
|
+
for (const segment of path115) {
|
|
9255
9255
|
const dotted = segment.kind === "key" || segment.kind === "entry";
|
|
9256
9256
|
const rendered = segmentText(segment);
|
|
9257
9257
|
text19 += dotted && text19 ? `.${rendered}` : rendered;
|
|
@@ -9422,11 +9422,11 @@ function enumValues(node) {
|
|
|
9422
9422
|
function opaqueConfigNode(inner, base) {
|
|
9423
9423
|
return { ...base, kind: "other", type: leafTypeOf(inner) };
|
|
9424
9424
|
}
|
|
9425
|
-
function build(node,
|
|
9425
|
+
function build(node, path115) {
|
|
9426
9426
|
const { inner, defaultValue, optional } = unwrapSchemaNode(node);
|
|
9427
9427
|
const secret = isSecretSchemaNode(node) || isSecretSchemaNode(inner);
|
|
9428
9428
|
const base = {
|
|
9429
|
-
path:
|
|
9429
|
+
path: path115,
|
|
9430
9430
|
...optional ? { optional: true } : {},
|
|
9431
9431
|
...defaultValue === void 0 ? {} : { defaultValue },
|
|
9432
9432
|
...secret ? { secret: true } : {}
|
|
@@ -9482,11 +9482,11 @@ function describeConfigLeaves(schema2) {
|
|
|
9482
9482
|
|
|
9483
9483
|
// src/commands/config/globalConfigFileLabel.ts
|
|
9484
9484
|
var WINDOWS_MOUNT_PREFIX = "/mnt/";
|
|
9485
|
-
function globalConfigFileLabel(
|
|
9486
|
-
if (
|
|
9487
|
-
if (
|
|
9488
|
-
return `${
|
|
9489
|
-
return
|
|
9485
|
+
function globalConfigFileLabel(path115) {
|
|
9486
|
+
if (path115 === getGlobalConfigPath()) return "~/.assist.yml";
|
|
9487
|
+
if (path115.startsWith(WINDOWS_MOUNT_PREFIX))
|
|
9488
|
+
return `${path115} on the Windows host`;
|
|
9489
|
+
return path115;
|
|
9490
9490
|
}
|
|
9491
9491
|
|
|
9492
9492
|
// src/shared/readUserConfigCache.ts
|
|
@@ -9544,35 +9544,35 @@ function isPlainRecord(value) {
|
|
|
9544
9544
|
}
|
|
9545
9545
|
|
|
9546
9546
|
// src/shared/mapConfigSecrets.ts
|
|
9547
|
-
function mapChildren(value,
|
|
9547
|
+
function mapChildren(value, path115, childNode, map) {
|
|
9548
9548
|
if (!isPlainRecord(value)) return value;
|
|
9549
9549
|
return Object.fromEntries(
|
|
9550
9550
|
Object.entries(value).map(([name2, child]) => [
|
|
9551
9551
|
name2,
|
|
9552
|
-
walk(child, [...
|
|
9552
|
+
walk(child, [...path115, name2], childNode(name2), map)
|
|
9553
9553
|
])
|
|
9554
9554
|
);
|
|
9555
9555
|
}
|
|
9556
|
-
function mapItems(value,
|
|
9556
|
+
function mapItems(value, path115, item, map) {
|
|
9557
9557
|
if (!Array.isArray(value)) return value;
|
|
9558
|
-
return value.map((entry, index3) => walk(entry, [...
|
|
9558
|
+
return value.map((entry, index3) => walk(entry, [...path115, index3], item, map));
|
|
9559
9559
|
}
|
|
9560
|
-
function walk(value,
|
|
9560
|
+
function walk(value, path115, node, map) {
|
|
9561
9561
|
if (!node || value === void 0 || value === null) return value;
|
|
9562
|
-
if (node.secret) return map(value,
|
|
9562
|
+
if (node.secret) return map(value, path115);
|
|
9563
9563
|
switch (node.kind) {
|
|
9564
9564
|
case "object":
|
|
9565
9565
|
case "unionOfObjects":
|
|
9566
9566
|
return mapChildren(
|
|
9567
9567
|
value,
|
|
9568
|
-
|
|
9568
|
+
path115,
|
|
9569
9569
|
(name2) => configNodeField(node, name2),
|
|
9570
9570
|
map
|
|
9571
9571
|
);
|
|
9572
9572
|
case "objectList":
|
|
9573
|
-
return mapItems(value,
|
|
9573
|
+
return mapItems(value, path115, node.item, map);
|
|
9574
9574
|
case "record":
|
|
9575
|
-
return mapChildren(value,
|
|
9575
|
+
return mapChildren(value, path115, () => node.value, map);
|
|
9576
9576
|
default:
|
|
9577
9577
|
return value;
|
|
9578
9578
|
}
|
|
@@ -9597,9 +9597,9 @@ function isTraversable(value) {
|
|
|
9597
9597
|
function stepInto(current2, key) {
|
|
9598
9598
|
return isTraversable(current2) ? current2[key] : void 0;
|
|
9599
9599
|
}
|
|
9600
|
-
function getNestedValue(obj,
|
|
9600
|
+
function getNestedValue(obj, path115) {
|
|
9601
9601
|
let current2 = obj;
|
|
9602
|
-
for (const key of
|
|
9602
|
+
for (const key of path115.split(".")) current2 = stepInto(current2, key);
|
|
9603
9603
|
return current2;
|
|
9604
9604
|
}
|
|
9605
9605
|
|
|
@@ -9650,9 +9650,9 @@ function step(node, segment) {
|
|
|
9650
9650
|
return void 0;
|
|
9651
9651
|
}
|
|
9652
9652
|
}
|
|
9653
|
-
function findConfigNode(root2,
|
|
9653
|
+
function findConfigNode(root2, path115) {
|
|
9654
9654
|
let current2 = root2;
|
|
9655
|
-
for (const segment of
|
|
9655
|
+
for (const segment of path115) {
|
|
9656
9656
|
if (!current2) return void 0;
|
|
9657
9657
|
current2 = step(current2, segment);
|
|
9658
9658
|
}
|
|
@@ -9669,34 +9669,34 @@ function nameSegment(name2) {
|
|
|
9669
9669
|
return name2 === RECORD_ENTRY_TOKEN ? { kind: "entry" } : { kind: "key", name: name2 };
|
|
9670
9670
|
}
|
|
9671
9671
|
function parseConfigPath(text19) {
|
|
9672
|
-
const
|
|
9672
|
+
const path115 = [];
|
|
9673
9673
|
let at2 = 0;
|
|
9674
9674
|
while (at2 < text19.length) {
|
|
9675
9675
|
if (text19[at2] === "[") {
|
|
9676
9676
|
const close = text19.indexOf("]", at2);
|
|
9677
9677
|
const segment = close === -1 ? void 0 : bracketSegment(text19.slice(at2 + 1, close));
|
|
9678
9678
|
if (!segment) return void 0;
|
|
9679
|
-
|
|
9679
|
+
path115.push(segment);
|
|
9680
9680
|
at2 = close + 1;
|
|
9681
9681
|
continue;
|
|
9682
9682
|
}
|
|
9683
9683
|
if (text19[at2] === ".") {
|
|
9684
|
-
if (
|
|
9684
|
+
if (path115.length === 0) return void 0;
|
|
9685
9685
|
at2 += 1;
|
|
9686
9686
|
}
|
|
9687
9687
|
const start2 = at2;
|
|
9688
9688
|
while (at2 < text19.length && text19[at2] !== "." && text19[at2] !== "[") at2 += 1;
|
|
9689
9689
|
const name2 = text19.slice(start2, at2);
|
|
9690
9690
|
if (!name2) return void 0;
|
|
9691
|
-
|
|
9691
|
+
path115.push(nameSegment(name2));
|
|
9692
9692
|
}
|
|
9693
|
-
return
|
|
9693
|
+
return path115;
|
|
9694
9694
|
}
|
|
9695
9695
|
|
|
9696
9696
|
// src/commands/config/configEntryNode.ts
|
|
9697
9697
|
function configEntryNode(root2, key) {
|
|
9698
|
-
const
|
|
9699
|
-
return
|
|
9698
|
+
const path115 = parseConfigPath(key);
|
|
9699
|
+
return path115 ? findConfigNode(root2, path115) : void 0;
|
|
9700
9700
|
}
|
|
9701
9701
|
|
|
9702
9702
|
// src/commands/advise/adviceConfigHelp.ts
|
|
@@ -10634,8 +10634,8 @@ function stepIntoNested(container, key, nextKey) {
|
|
|
10634
10634
|
}
|
|
10635
10635
|
return ensureObject(container, resolved);
|
|
10636
10636
|
}
|
|
10637
|
-
function setNestedValue(obj,
|
|
10638
|
-
const keys =
|
|
10637
|
+
function setNestedValue(obj, path115, value) {
|
|
10638
|
+
const keys = path115.split(".");
|
|
10639
10639
|
const result = { ...obj };
|
|
10640
10640
|
let current2 = result;
|
|
10641
10641
|
for (let i = 0; i < keys.length - 1; i++) {
|
|
@@ -10870,7 +10870,7 @@ function findSynthesisForBranch(repoReviewsDir, branch2) {
|
|
|
10870
10870
|
const parent = dirname11(branchKeyPath);
|
|
10871
10871
|
const branchPrefix = basename9(branchKeyPath);
|
|
10872
10872
|
if (!existsSync24(parent)) return null;
|
|
10873
|
-
const synthesisFiles = readdirSync8(parent).filter((name2) => name2.startsWith(branchPrefix)).map((name2) => join27(parent, name2, "synthesis.md")).filter((
|
|
10873
|
+
const synthesisFiles = readdirSync8(parent).filter((name2) => name2.startsWith(branchPrefix)).map((name2) => join27(parent, name2, "synthesis.md")).filter((path115) => existsSync24(path115)).map((path115) => ({ path: path115, mtime: statSync6(path115).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
|
|
10874
10874
|
return synthesisFiles[0]?.path ?? null;
|
|
10875
10875
|
}
|
|
10876
10876
|
|
|
@@ -10900,12 +10900,12 @@ async function getReviewSynthesis(req, res) {
|
|
|
10900
10900
|
const cwd = getCwdParam(req, res);
|
|
10901
10901
|
if (!cwd) return;
|
|
10902
10902
|
try {
|
|
10903
|
-
const
|
|
10904
|
-
if (!
|
|
10903
|
+
const path115 = await resolveSynthesisPath(cwd);
|
|
10904
|
+
if (!path115) {
|
|
10905
10905
|
respondJson(res, 404, { error: "No synthesis found" });
|
|
10906
10906
|
return;
|
|
10907
10907
|
}
|
|
10908
|
-
respondJson(res, 200, { synthesis: readFileSync11(
|
|
10908
|
+
respondJson(res, 200, { synthesis: readFileSync11(path115, "utf8") });
|
|
10909
10909
|
} catch {
|
|
10910
10910
|
respondJson(res, 404, { error: "No synthesis found" });
|
|
10911
10911
|
}
|
|
@@ -10927,19 +10927,19 @@ var execFileAsync7 = promisify7(execFile7);
|
|
|
10927
10927
|
var MAX_FILE_BYTES2 = 2 * 1024 * 1024;
|
|
10928
10928
|
var REPO = /^[\w.-]+\/[\w.-]+$/;
|
|
10929
10929
|
var SHA = /^[0-9a-f]{7,40}$/i;
|
|
10930
|
-
function validPath(
|
|
10931
|
-
return
|
|
10930
|
+
function validPath(path115) {
|
|
10931
|
+
return path115.length > 0 && !path115.startsWith("/") && path115.split("/").every((part) => part !== "" && part !== "..");
|
|
10932
10932
|
}
|
|
10933
10933
|
async function githubFileContent(req, res) {
|
|
10934
10934
|
const params = new URL(req.url ?? "/", "http://localhost").searchParams;
|
|
10935
10935
|
const repo = params.get("repo") ?? "";
|
|
10936
10936
|
const sha = params.get("sha") ?? "";
|
|
10937
|
-
const
|
|
10938
|
-
if (!REPO.test(repo) || !SHA.test(sha) || !validPath(
|
|
10937
|
+
const path115 = params.get("path") ?? "";
|
|
10938
|
+
if (!REPO.test(repo) || !SHA.test(sha) || !validPath(path115)) {
|
|
10939
10939
|
respondJson(res, 400, { error: "Invalid repo, sha or path" });
|
|
10940
10940
|
return;
|
|
10941
10941
|
}
|
|
10942
|
-
const encodedPath =
|
|
10942
|
+
const encodedPath = path115.split("/").map(encodeURIComponent).join("/");
|
|
10943
10943
|
try {
|
|
10944
10944
|
const { stdout } = await execFileAsync7(
|
|
10945
10945
|
"gh",
|
|
@@ -11106,8 +11106,8 @@ function parseDiffNameStatus(output) {
|
|
|
11106
11106
|
if (!status2 || fields.length < 2) continue;
|
|
11107
11107
|
const category = categorize(status2[0]);
|
|
11108
11108
|
if (!category) continue;
|
|
11109
|
-
const
|
|
11110
|
-
if (
|
|
11109
|
+
const path115 = fields[fields.length - 1];
|
|
11110
|
+
if (path115) result[category].push(path115);
|
|
11111
11111
|
}
|
|
11112
11112
|
return result;
|
|
11113
11113
|
}
|
|
@@ -11513,24 +11513,24 @@ function getOwnerPath(itemId2) {
|
|
|
11513
11513
|
function recordSignalOwner(itemId2) {
|
|
11514
11514
|
const sessionId2 = process.env.ASSIST_SESSION_ID;
|
|
11515
11515
|
if (!sessionId2) return;
|
|
11516
|
-
const
|
|
11517
|
-
mkdirSync7(dirname12(
|
|
11518
|
-
writeFileSync7(
|
|
11516
|
+
const path115 = getOwnerPath(itemId2);
|
|
11517
|
+
mkdirSync7(dirname12(path115), { recursive: true });
|
|
11518
|
+
writeFileSync7(path115, JSON.stringify({ sessionId: sessionId2 }));
|
|
11519
11519
|
}
|
|
11520
11520
|
function readSignalOwner(itemId2) {
|
|
11521
|
-
const
|
|
11522
|
-
if (!existsSync25(
|
|
11521
|
+
const path115 = getOwnerPath(itemId2);
|
|
11522
|
+
if (!existsSync25(path115)) return void 0;
|
|
11523
11523
|
try {
|
|
11524
|
-
const parsed = JSON.parse(readFileSync12(
|
|
11524
|
+
const parsed = JSON.parse(readFileSync12(path115, "utf8"));
|
|
11525
11525
|
return parsed.sessionId;
|
|
11526
11526
|
} catch {
|
|
11527
11527
|
return void 0;
|
|
11528
11528
|
}
|
|
11529
11529
|
}
|
|
11530
11530
|
function clearSignalOwner(itemId2) {
|
|
11531
|
-
const
|
|
11531
|
+
const path115 = getOwnerPath(itemId2);
|
|
11532
11532
|
try {
|
|
11533
|
-
rmSync3(
|
|
11533
|
+
rmSync3(path115);
|
|
11534
11534
|
} catch {
|
|
11535
11535
|
}
|
|
11536
11536
|
}
|
|
@@ -11567,11 +11567,11 @@ function resolveSignalTarget(event, data) {
|
|
|
11567
11567
|
function writeSignal(event, data) {
|
|
11568
11568
|
const target = resolveSignalTarget(event, data);
|
|
11569
11569
|
if (!target) return;
|
|
11570
|
-
const
|
|
11571
|
-
if (!
|
|
11570
|
+
const path115 = getSignalPath(target);
|
|
11571
|
+
if (!path115) return;
|
|
11572
11572
|
const signal = { event, sessionId: target, ...data };
|
|
11573
|
-
mkdirSync8(dirname13(
|
|
11574
|
-
writeFileSync8(
|
|
11573
|
+
mkdirSync8(dirname13(path115), { recursive: true });
|
|
11574
|
+
writeFileSync8(path115, JSON.stringify(signal));
|
|
11575
11575
|
}
|
|
11576
11576
|
|
|
11577
11577
|
// src/commands/backlog/rewindItemToPhase.ts
|
|
@@ -11999,11 +11999,11 @@ function logLinkedRequest(req, res) {
|
|
|
11999
11999
|
const started2 = Date.now();
|
|
12000
12000
|
const from = req.headers[LINKED_FROM_HEADER2];
|
|
12001
12001
|
const trace = req.headers[TRACE_HEADER] ?? "none";
|
|
12002
|
-
const
|
|
12002
|
+
const path115 = new URL(req.url ?? "/", "http://localhost").pathname;
|
|
12003
12003
|
res.once("finish", () => {
|
|
12004
|
-
if (isQuietPoll(
|
|
12004
|
+
if (isQuietPoll(path115, res.statusCode)) return;
|
|
12005
12005
|
console.log(
|
|
12006
|
-
`link-from ${from} http: ${req.method} ${
|
|
12006
|
+
`link-from ${from} http: ${req.method} ${path115} trace=${trace} -> ${res.statusCode} (${Date.now() - started2}ms)`
|
|
12007
12007
|
);
|
|
12008
12008
|
});
|
|
12009
12009
|
}
|
|
@@ -12524,21 +12524,21 @@ function subsequenceScore(text19, query) {
|
|
|
12524
12524
|
}
|
|
12525
12525
|
return score - Math.min(text19.length, MAX_LENGTH_PENALTY);
|
|
12526
12526
|
}
|
|
12527
|
-
function scoreFilePath(
|
|
12527
|
+
function scoreFilePath(path115, query) {
|
|
12528
12528
|
const needle = query.trim().toLowerCase();
|
|
12529
12529
|
if (!needle) return 0;
|
|
12530
|
-
const basename38 =
|
|
12530
|
+
const basename38 = path115.slice(path115.lastIndexOf("/") + 1);
|
|
12531
12531
|
const inBasename = subsequenceScore(basename38, needle);
|
|
12532
12532
|
if (inBasename !== null) return BASENAME_WEIGHT + inBasename;
|
|
12533
|
-
return subsequenceScore(
|
|
12533
|
+
return subsequenceScore(path115, needle);
|
|
12534
12534
|
}
|
|
12535
12535
|
|
|
12536
12536
|
// src/commands/sessions/web/rankFilePaths.ts
|
|
12537
12537
|
function rankFilePaths(paths, query, limit) {
|
|
12538
12538
|
const scored = [];
|
|
12539
|
-
for (const
|
|
12540
|
-
const score = scoreFilePath(
|
|
12541
|
-
if (score !== null) scored.push({ path:
|
|
12539
|
+
for (const path115 of paths) {
|
|
12540
|
+
const score = scoreFilePath(path115, query);
|
|
12541
|
+
if (score !== null) scored.push({ path: path115, score });
|
|
12542
12542
|
}
|
|
12543
12543
|
scored.sort((a, b) => b.score - a.score || a.path.localeCompare(b.path));
|
|
12544
12544
|
return scored.slice(0, limit).map((entry) => entry.path);
|
|
@@ -14047,8 +14047,8 @@ import { stat as stat2 } from "fs/promises";
|
|
|
14047
14047
|
|
|
14048
14048
|
// src/shared/isStagedAttachmentPath.ts
|
|
14049
14049
|
import { isAbsolute as isAbsolute3, relative as relative3, resolve as resolve9, sep } from "path";
|
|
14050
|
-
function isStagedAttachmentPath(
|
|
14051
|
-
const rel = relative3(stagedAttachmentsDir, resolve9(
|
|
14050
|
+
function isStagedAttachmentPath(path115) {
|
|
14051
|
+
const rel = relative3(stagedAttachmentsDir, resolve9(path115));
|
|
14052
14052
|
return rel !== "" && rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute3(rel);
|
|
14053
14053
|
}
|
|
14054
14054
|
|
|
@@ -14068,8 +14068,8 @@ var attachmentMimeTypes = {
|
|
|
14068
14068
|
};
|
|
14069
14069
|
|
|
14070
14070
|
// src/commands/sessions/web/attachmentContentType.ts
|
|
14071
|
-
function attachmentContentType(
|
|
14072
|
-
const ext = extname(
|
|
14071
|
+
function attachmentContentType(path115) {
|
|
14072
|
+
const ext = extname(path115).replace(/^\./, "").toLowerCase();
|
|
14073
14073
|
const match = Object.entries(attachmentMimeTypes).find(([, e]) => e === ext);
|
|
14074
14074
|
return match?.[0] ?? "application/octet-stream";
|
|
14075
14075
|
}
|
|
@@ -14077,22 +14077,22 @@ function attachmentContentType(path114) {
|
|
|
14077
14077
|
// src/commands/sessions/web/previewImage.ts
|
|
14078
14078
|
async function previewImage(req, res) {
|
|
14079
14079
|
const url = new URL(req.url ?? "/", "http://localhost");
|
|
14080
|
-
const
|
|
14081
|
-
if (!isStagedAttachmentPath(
|
|
14080
|
+
const path115 = url.searchParams.get("path") ?? "";
|
|
14081
|
+
if (!isStagedAttachmentPath(path115)) {
|
|
14082
14082
|
respondJson(res, 400, { error: "Not a staged attachment." });
|
|
14083
14083
|
return;
|
|
14084
14084
|
}
|
|
14085
|
-
const info = await stat2(
|
|
14085
|
+
const info = await stat2(path115).catch(() => null);
|
|
14086
14086
|
if (!info?.isFile()) {
|
|
14087
14087
|
respondJson(res, 404, { error: "Attachment is no longer staged." });
|
|
14088
14088
|
return;
|
|
14089
14089
|
}
|
|
14090
14090
|
res.writeHead(200, {
|
|
14091
|
-
"Content-Type": attachmentContentType(
|
|
14091
|
+
"Content-Type": attachmentContentType(path115),
|
|
14092
14092
|
"Content-Length": info.size,
|
|
14093
14093
|
"Cache-Control": "no-store"
|
|
14094
14094
|
});
|
|
14095
|
-
createReadStream2(
|
|
14095
|
+
createReadStream2(path115).pipe(res);
|
|
14096
14096
|
}
|
|
14097
14097
|
|
|
14098
14098
|
// src/commands/sessions/web/getCurrentBranch.ts
|
|
@@ -14529,8 +14529,8 @@ async function liveDeployments(cwd, repo, environments) {
|
|
|
14529
14529
|
|
|
14530
14530
|
// src/commands/sessions/web/releases/latestRun.ts
|
|
14531
14531
|
async function latestRun(cwd, repo, workflow) {
|
|
14532
|
-
const
|
|
14533
|
-
const response = await ghJson(cwd, ["api",
|
|
14532
|
+
const path115 = `repos/${repo}/actions/workflows/${encodeURIComponent(workflow)}/runs?per_page=1&exclude_pull_requests=true`;
|
|
14533
|
+
const response = await ghJson(cwd, ["api", path115]);
|
|
14534
14534
|
const run5 = response.workflow_runs?.[0];
|
|
14535
14535
|
if (!run5) return null;
|
|
14536
14536
|
return {
|
|
@@ -14825,36 +14825,36 @@ import { relative as relative4 } from "path";
|
|
|
14825
14825
|
function git(cwd, args) {
|
|
14826
14826
|
return execGit(cwd, ["--literal-pathspecs", ...args]);
|
|
14827
14827
|
}
|
|
14828
|
-
async function isTracked(cwd,
|
|
14828
|
+
async function isTracked(cwd, path115) {
|
|
14829
14829
|
try {
|
|
14830
|
-
await git(cwd, ["ls-files", "--error-unmatch", "--",
|
|
14830
|
+
await git(cwd, ["ls-files", "--error-unmatch", "--", path115]);
|
|
14831
14831
|
return true;
|
|
14832
14832
|
} catch {
|
|
14833
14833
|
return false;
|
|
14834
14834
|
}
|
|
14835
14835
|
}
|
|
14836
|
-
async function isInHead(cwd,
|
|
14837
|
-
const listing = await git(cwd, ["ls-tree", "HEAD", "--",
|
|
14836
|
+
async function isInHead(cwd, path115) {
|
|
14837
|
+
const listing = await git(cwd, ["ls-tree", "HEAD", "--", path115]);
|
|
14838
14838
|
return listing.trim().length > 0;
|
|
14839
14839
|
}
|
|
14840
|
-
async function hasChanges(cwd,
|
|
14840
|
+
async function hasChanges(cwd, path115) {
|
|
14841
14841
|
const status2 = await git(cwd, [
|
|
14842
14842
|
"status",
|
|
14843
14843
|
"--porcelain",
|
|
14844
14844
|
"-z",
|
|
14845
14845
|
"--untracked-files=all",
|
|
14846
14846
|
"--",
|
|
14847
|
-
|
|
14847
|
+
path115
|
|
14848
14848
|
]);
|
|
14849
14849
|
return status2.length > 0;
|
|
14850
14850
|
}
|
|
14851
|
-
async function renameSources(cwd,
|
|
14851
|
+
async function renameSources(cwd, path115) {
|
|
14852
14852
|
const fields = (await git(cwd, ["diff", "HEAD", "--name-status", "-z"])).split("\0");
|
|
14853
14853
|
const sources = [];
|
|
14854
14854
|
for (let i = 0; i < fields.length; ) {
|
|
14855
14855
|
const status2 = fields[i];
|
|
14856
14856
|
if (status2.startsWith("R")) {
|
|
14857
|
-
if (fields[i + 2] ===
|
|
14857
|
+
if (fields[i + 2] === path115) sources.push(fields[i + 1]);
|
|
14858
14858
|
i += 3;
|
|
14859
14859
|
} else {
|
|
14860
14860
|
i += status2.startsWith("C") ? 3 : 2;
|
|
@@ -14862,34 +14862,34 @@ async function renameSources(cwd, path114) {
|
|
|
14862
14862
|
}
|
|
14863
14863
|
return sources;
|
|
14864
14864
|
}
|
|
14865
|
-
async function restorePath(cwd,
|
|
14866
|
-
if (await isInHead(cwd,
|
|
14867
|
-
await git(cwd, ["checkout", "HEAD", "--",
|
|
14865
|
+
async function restorePath(cwd, path115) {
|
|
14866
|
+
if (await isInHead(cwd, path115)) {
|
|
14867
|
+
await git(cwd, ["checkout", "HEAD", "--", path115]);
|
|
14868
14868
|
return;
|
|
14869
14869
|
}
|
|
14870
|
-
if (await isTracked(cwd,
|
|
14871
|
-
await git(cwd, ["rm", "-f", "--",
|
|
14870
|
+
if (await isTracked(cwd, path115)) {
|
|
14871
|
+
await git(cwd, ["rm", "-f", "--", path115]);
|
|
14872
14872
|
return;
|
|
14873
14873
|
}
|
|
14874
|
-
await git(cwd, ["clean", "-f", "--",
|
|
14874
|
+
await git(cwd, ["clean", "-f", "--", path115]);
|
|
14875
14875
|
}
|
|
14876
|
-
async function revertPathChanges(cwd,
|
|
14877
|
-
if (!await hasChanges(cwd,
|
|
14878
|
-
throw new Error(`No uncommitted changes found for ${
|
|
14879
|
-
for (const target of [...await renameSources(cwd,
|
|
14876
|
+
async function revertPathChanges(cwd, path115) {
|
|
14877
|
+
if (!await hasChanges(cwd, path115))
|
|
14878
|
+
throw new Error(`No uncommitted changes found for ${path115}`);
|
|
14879
|
+
for (const target of [...await renameSources(cwd, path115), path115])
|
|
14880
14880
|
await restorePath(cwd, target);
|
|
14881
|
-
if (await hasChanges(cwd,
|
|
14882
|
-
throw new Error(`${
|
|
14881
|
+
if (await hasChanges(cwd, path115))
|
|
14882
|
+
throw new Error(`${path115} still has uncommitted changes`);
|
|
14883
14883
|
}
|
|
14884
14884
|
|
|
14885
14885
|
// src/commands/sessions/web/revertDiffFile.ts
|
|
14886
14886
|
async function revertDiffFile(req, res) {
|
|
14887
14887
|
const resolved = getFileTarget(req, res);
|
|
14888
14888
|
if (!resolved) return;
|
|
14889
|
-
const
|
|
14889
|
+
const path115 = relative4(repoRoot2(resolved.cwd), resolved.target);
|
|
14890
14890
|
try {
|
|
14891
|
-
await revertPathChanges(resolved.cwd,
|
|
14892
|
-
respondJson(res, 200, { reverted:
|
|
14891
|
+
await revertPathChanges(resolved.cwd, path115);
|
|
14892
|
+
respondJson(res, 200, { reverted: path115 });
|
|
14893
14893
|
} catch (error) {
|
|
14894
14894
|
respondJson(res, 500, {
|
|
14895
14895
|
error: error instanceof Error ? error.message : "Failed to revert file"
|
|
@@ -15001,7 +15001,7 @@ import { relative as relative5 } from "path";
|
|
|
15001
15001
|
function requestedPaths(body) {
|
|
15002
15002
|
const paths = body.paths;
|
|
15003
15003
|
if (!Array.isArray(paths)) return null;
|
|
15004
|
-
if (paths.some((
|
|
15004
|
+
if (paths.some((path115) => typeof path115 !== "string")) return null;
|
|
15005
15005
|
return paths;
|
|
15006
15006
|
}
|
|
15007
15007
|
async function revertDiffPaths(req, res) {
|
|
@@ -15021,10 +15021,10 @@ async function revertDiffPaths(req, res) {
|
|
|
15021
15021
|
const root2 = repoRoot2(cwd);
|
|
15022
15022
|
const reverted = [];
|
|
15023
15023
|
const failed3 = [];
|
|
15024
|
-
for (const
|
|
15025
|
-
const target = resolveWithinCwd(cwd,
|
|
15024
|
+
for (const path115 of paths) {
|
|
15025
|
+
const target = resolveWithinCwd(cwd, path115);
|
|
15026
15026
|
if (!target) {
|
|
15027
|
-
failed3.push({ path:
|
|
15027
|
+
failed3.push({ path: path115, error: "Path outside cwd" });
|
|
15028
15028
|
continue;
|
|
15029
15029
|
}
|
|
15030
15030
|
const relativePath = relative5(root2, target);
|
|
@@ -15084,13 +15084,13 @@ function describePeerError(error) {
|
|
|
15084
15084
|
const cause = error.cause;
|
|
15085
15085
|
return cause instanceof Error ? `${error.message}: ${describePeerError(cause)}` : error.message;
|
|
15086
15086
|
}
|
|
15087
|
-
async function fetchPeerJson(baseUrl2,
|
|
15088
|
-
const res = await fetch(new URL(
|
|
15087
|
+
async function fetchPeerJson(baseUrl2, path115, timeoutMs = PEER_TIMEOUT_MS) {
|
|
15088
|
+
const res = await fetch(new URL(path115, baseUrl2), {
|
|
15089
15089
|
signal: AbortSignal.timeout(timeoutMs)
|
|
15090
15090
|
});
|
|
15091
15091
|
if (!res.ok)
|
|
15092
15092
|
throw Object.assign(
|
|
15093
|
-
new Error(`GET ${
|
|
15093
|
+
new Error(`GET ${path115} returned ${res.status} ${res.statusText}`),
|
|
15094
15094
|
{ status: res.status }
|
|
15095
15095
|
);
|
|
15096
15096
|
return await res.json();
|
|
@@ -15491,8 +15491,8 @@ async function inviteTeamMember(client, appId, email) {
|
|
|
15491
15491
|
}
|
|
15492
15492
|
|
|
15493
15493
|
// src/commands/testflight/addInternalTester.ts
|
|
15494
|
-
async function hasMatch(client,
|
|
15495
|
-
const { data } = await client.get(
|
|
15494
|
+
async function hasMatch(client, path115, params, attribute, email) {
|
|
15495
|
+
const { data } = await client.get(path115, params);
|
|
15496
15496
|
return data.some(
|
|
15497
15497
|
(item) => String(item.attributes?.[attribute]).toLowerCase() === email.toLowerCase()
|
|
15498
15498
|
);
|
|
@@ -15533,9 +15533,9 @@ function parseErrors(body) {
|
|
|
15533
15533
|
return body ? [body] : [];
|
|
15534
15534
|
}
|
|
15535
15535
|
}
|
|
15536
|
-
function formatAscError(method,
|
|
15536
|
+
function formatAscError(method, path115, status2, body) {
|
|
15537
15537
|
const lines = [
|
|
15538
|
-
`App Store Connect ${method} ${
|
|
15538
|
+
`App Store Connect ${method} ${path115} failed (${status2})`,
|
|
15539
15539
|
...parseErrors(body).map((line) => ` ${line}`)
|
|
15540
15540
|
];
|
|
15541
15541
|
const hint = statusHints[status2];
|
|
@@ -15552,9 +15552,9 @@ var TestflightError = class extends Error {
|
|
|
15552
15552
|
function baseUrl() {
|
|
15553
15553
|
return process.env.ASSIST_ASC_BASE_URL ?? "https://api.appstoreconnect.apple.com";
|
|
15554
15554
|
}
|
|
15555
|
-
async function send(fetchFn, token, method,
|
|
15555
|
+
async function send(fetchFn, token, method, path115, body) {
|
|
15556
15556
|
try {
|
|
15557
|
-
return await fetchFn(`${baseUrl()}${
|
|
15557
|
+
return await fetchFn(`${baseUrl()}${path115}`, {
|
|
15558
15558
|
method,
|
|
15559
15559
|
headers: {
|
|
15560
15560
|
Authorization: `Bearer ${token}`,
|
|
@@ -15568,12 +15568,12 @@ async function send(fetchFn, token, method, path114, body) {
|
|
|
15568
15568
|
throw new TestflightError(`Failed to reach App Store Connect: ${reason4}`);
|
|
15569
15569
|
}
|
|
15570
15570
|
}
|
|
15571
|
-
async function ascRequest(fetchFn, token, method,
|
|
15572
|
-
const response = await send(fetchFn, token, method,
|
|
15571
|
+
async function ascRequest(fetchFn, token, method, path115, body) {
|
|
15572
|
+
const response = await send(fetchFn, token, method, path115, body);
|
|
15573
15573
|
const text19 = await response.text();
|
|
15574
15574
|
if (!response.ok) {
|
|
15575
15575
|
throw new TestflightError(
|
|
15576
|
-
formatAscError(method,
|
|
15576
|
+
formatAscError(method, path115.split("?")[0], response.status, text19)
|
|
15577
15577
|
);
|
|
15578
15578
|
}
|
|
15579
15579
|
return text19 ? JSON.parse(text19) : void 0;
|
|
@@ -15582,11 +15582,11 @@ async function ascRequest(fetchFn, token, method, path114, body) {
|
|
|
15582
15582
|
// src/commands/testflight/createAscClient.ts
|
|
15583
15583
|
function createAscClient(token, fetchFn = fetch) {
|
|
15584
15584
|
return {
|
|
15585
|
-
get: (
|
|
15585
|
+
get: (path115, params) => {
|
|
15586
15586
|
const query = params ? `?${new URLSearchParams(params)}` : "";
|
|
15587
|
-
return ascRequest(fetchFn, token, "GET", `${
|
|
15587
|
+
return ascRequest(fetchFn, token, "GET", `${path115}${query}`);
|
|
15588
15588
|
},
|
|
15589
|
-
post: (
|
|
15589
|
+
post: (path115, body) => ascRequest(fetchFn, token, "POST", path115, body)
|
|
15590
15590
|
};
|
|
15591
15591
|
}
|
|
15592
15592
|
|
|
@@ -15932,11 +15932,11 @@ function parseJson(raw) {
|
|
|
15932
15932
|
}
|
|
15933
15933
|
}
|
|
15934
15934
|
function formatIssue(key, issue) {
|
|
15935
|
-
const
|
|
15935
|
+
const path115 = formatConfigPath([
|
|
15936
15936
|
{ kind: "key", name: key },
|
|
15937
15937
|
...issue.path.map(toSegment)
|
|
15938
15938
|
]);
|
|
15939
|
-
return `${
|
|
15939
|
+
return `${path115}: ${issue.message}`;
|
|
15940
15940
|
}
|
|
15941
15941
|
function toSegment(part) {
|
|
15942
15942
|
return typeof part === "number" ? { kind: "index", index: part } : { kind: "key", name: String(part) };
|
|
@@ -16031,9 +16031,9 @@ function coerceUnion(key, raw, types) {
|
|
|
16031
16031
|
}
|
|
16032
16032
|
|
|
16033
16033
|
// src/shared/valueAtConfigPath.ts
|
|
16034
|
-
function valueAtConfigPath(value,
|
|
16034
|
+
function valueAtConfigPath(value, path115) {
|
|
16035
16035
|
let current2 = value;
|
|
16036
|
-
for (const key of
|
|
16036
|
+
for (const key of path115) {
|
|
16037
16037
|
if (typeof key === "number") {
|
|
16038
16038
|
if (!Array.isArray(current2)) return void 0;
|
|
16039
16039
|
current2 = current2[key];
|
|
@@ -16050,7 +16050,7 @@ function restoreConfigSecrets(value, stored, node) {
|
|
|
16050
16050
|
return mapConfigSecrets(
|
|
16051
16051
|
value,
|
|
16052
16052
|
node,
|
|
16053
|
-
(secret,
|
|
16053
|
+
(secret, path115) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path115) : secret
|
|
16054
16054
|
);
|
|
16055
16055
|
}
|
|
16056
16056
|
|
|
@@ -16079,8 +16079,8 @@ function formatIssue2(issue, key) {
|
|
|
16079
16079
|
return issue.keys.map(
|
|
16080
16080
|
(unrecognized) => `${[...issue.path, unrecognized].join(".")}: Unrecognized key`
|
|
16081
16081
|
);
|
|
16082
|
-
const
|
|
16083
|
-
return [`${
|
|
16082
|
+
const path115 = issue.path.length > 0 ? issue.path.join(".") : key;
|
|
16083
|
+
return [`${path115}: ${issue.message}`];
|
|
16084
16084
|
}
|
|
16085
16085
|
|
|
16086
16086
|
// src/commands/config/applyConfigSet.ts
|
|
@@ -16177,16 +16177,16 @@ async function readUserConfig(orm) {
|
|
|
16177
16177
|
import { mkdirSync as mkdirSync9, renameSync as renameSync3, writeFileSync as writeFileSync9 } from "fs";
|
|
16178
16178
|
import { dirname as dirname15 } from "path";
|
|
16179
16179
|
function writeRepoConfigCache(repos2, user = {}) {
|
|
16180
|
-
const
|
|
16181
|
-
mkdirSync9(dirname15(
|
|
16180
|
+
const path115 = repoConfigCachePath();
|
|
16181
|
+
mkdirSync9(dirname15(path115), { recursive: true });
|
|
16182
16182
|
const cache7 = {
|
|
16183
16183
|
refreshedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
16184
16184
|
repos: repos2,
|
|
16185
16185
|
user
|
|
16186
16186
|
};
|
|
16187
|
-
const tmp = `${
|
|
16187
|
+
const tmp = `${path115}.${process.pid}.tmp`;
|
|
16188
16188
|
writeFileSync9(tmp, JSON.stringify(cache7, null, 2));
|
|
16189
|
-
renameSync3(tmp,
|
|
16189
|
+
renameSync3(tmp, path115);
|
|
16190
16190
|
}
|
|
16191
16191
|
|
|
16192
16192
|
// src/shared/refreshRepoConfigCache.ts
|
|
@@ -16359,8 +16359,8 @@ function seesApp(item, appId) {
|
|
|
16359
16359
|
const linked = item.relationships?.visibleApps?.data;
|
|
16360
16360
|
return Array.isArray(linked) && linked.some((app) => app.id === appId);
|
|
16361
16361
|
}
|
|
16362
|
-
async function listEmails(client,
|
|
16363
|
-
const { data } = await client.get(
|
|
16362
|
+
async function listEmails(client, path115, type, emailAttribute, appId) {
|
|
16363
|
+
const { data } = await client.get(path115, {
|
|
16364
16364
|
include: "visibleApps",
|
|
16365
16365
|
[`fields[${type}]`]: `${emailAttribute},allAppsVisible,visibleApps`,
|
|
16366
16366
|
"fields[apps]": "bundleId",
|
|
@@ -16544,8 +16544,8 @@ function removeAt(container, keys) {
|
|
|
16544
16544
|
}
|
|
16545
16545
|
return removeFromChild(container, key, rest);
|
|
16546
16546
|
}
|
|
16547
|
-
function unsetNestedValue(obj,
|
|
16548
|
-
const { container, removed } = removeAt(obj,
|
|
16547
|
+
function unsetNestedValue(obj, path115) {
|
|
16548
|
+
const { container, removed } = removeAt(obj, path115.split("."));
|
|
16549
16549
|
return { config: container, removed };
|
|
16550
16550
|
}
|
|
16551
16551
|
|
|
@@ -16858,12 +16858,12 @@ var sessionsPrefix = "src/commands/sessions/";
|
|
|
16858
16858
|
var restartRules = [
|
|
16859
16859
|
{
|
|
16860
16860
|
target: "webserver",
|
|
16861
|
-
matches: (
|
|
16861
|
+
matches: (path115) => path115.startsWith(webUiPrefix),
|
|
16862
16862
|
advice: "restart the web server, then hard-reload the browser tab"
|
|
16863
16863
|
},
|
|
16864
16864
|
{
|
|
16865
16865
|
target: "daemon",
|
|
16866
|
-
matches: (
|
|
16866
|
+
matches: (path115) => path115.startsWith(sessionsPrefix) && !path115.startsWith(webUiPrefix),
|
|
16867
16867
|
advice: "restart the daemon"
|
|
16868
16868
|
}
|
|
16869
16869
|
];
|
|
@@ -16928,11 +16928,11 @@ import { basename as basename13, join as join37 } from "path";
|
|
|
16928
16928
|
// src/commands/sessions/daemon/worktree/canonicalTreePath.ts
|
|
16929
16929
|
import { realpathSync } from "fs";
|
|
16930
16930
|
import { resolve as resolve12 } from "path";
|
|
16931
|
-
function canonicalTreePath(
|
|
16931
|
+
function canonicalTreePath(path115) {
|
|
16932
16932
|
try {
|
|
16933
|
-
return realpathSync(
|
|
16933
|
+
return realpathSync(path115);
|
|
16934
16934
|
} catch {
|
|
16935
|
-
return resolve12(
|
|
16935
|
+
return resolve12(path115);
|
|
16936
16936
|
}
|
|
16937
16937
|
}
|
|
16938
16938
|
|
|
@@ -17675,22 +17675,22 @@ function scheduleReconnect() {
|
|
|
17675
17675
|
import { mkdirSync as mkdirSync10, readFileSync as readFileSync18, writeFileSync as writeFileSync10 } from "fs";
|
|
17676
17676
|
import { dirname as dirname20, join as join41 } from "path";
|
|
17677
17677
|
var defaultPath = join41(daemonPaths.dir, "auto-restart-attempts.json");
|
|
17678
|
-
function read(
|
|
17678
|
+
function read(path115) {
|
|
17679
17679
|
try {
|
|
17680
|
-
return JSON.parse(readFileSync18(
|
|
17680
|
+
return JSON.parse(readFileSync18(path115, "utf8"));
|
|
17681
17681
|
} catch {
|
|
17682
17682
|
return {};
|
|
17683
17683
|
}
|
|
17684
17684
|
}
|
|
17685
|
-
function autoRestartAttempts(port,
|
|
17685
|
+
function autoRestartAttempts(port, path115 = defaultPath) {
|
|
17686
17686
|
const key = String(port);
|
|
17687
17687
|
return {
|
|
17688
|
-
get: () => read(
|
|
17688
|
+
get: () => read(path115)[key],
|
|
17689
17689
|
set: (built) => {
|
|
17690
|
-
mkdirSync10(dirname20(
|
|
17690
|
+
mkdirSync10(dirname20(path115), { recursive: true });
|
|
17691
17691
|
writeFileSync10(
|
|
17692
|
-
|
|
17693
|
-
`${JSON.stringify({ ...read(
|
|
17692
|
+
path115,
|
|
17693
|
+
`${JSON.stringify({ ...read(path115), [key]: built }, null, 2)}
|
|
17694
17694
|
`
|
|
17695
17695
|
);
|
|
17696
17696
|
}
|
|
@@ -18000,29 +18000,29 @@ function gitCommonDir(cwd) {
|
|
|
18000
18000
|
var REGISTRY_FILE = "worktrees.json";
|
|
18001
18001
|
function readWorktreeRegistry() {
|
|
18002
18002
|
const data = loadJson(REGISTRY_FILE);
|
|
18003
|
-
return Object.entries(data).filter(([, record3]) => !record3.reaped).map(([
|
|
18003
|
+
return Object.entries(data).filter(([, record3]) => !record3.reaped).map(([path115, { reaped: _reaped, ...record3 }]) => ({ path: path115, ...record3 }));
|
|
18004
18004
|
}
|
|
18005
|
-
function worktreeAttributionIncludingReaped(
|
|
18006
|
-
const record3 = loadJson(REGISTRY_FILE)[
|
|
18005
|
+
function worktreeAttributionIncludingReaped(path115) {
|
|
18006
|
+
const record3 = loadJson(REGISTRY_FILE)[path115];
|
|
18007
18007
|
return record3 ? { clone: record3.clone, origin: record3.origin } : void 0;
|
|
18008
18008
|
}
|
|
18009
|
-
function recordWorktree(
|
|
18009
|
+
function recordWorktree(path115, clone, origin) {
|
|
18010
18010
|
const data = loadJson(REGISTRY_FILE);
|
|
18011
|
-
data[
|
|
18011
|
+
data[path115] = { clone, origin };
|
|
18012
18012
|
saveJson(REGISTRY_FILE, data);
|
|
18013
18013
|
}
|
|
18014
|
-
function recordWorktreeHarness(
|
|
18014
|
+
function recordWorktreeHarness(path115, harness) {
|
|
18015
18015
|
const data = loadJson(REGISTRY_FILE);
|
|
18016
|
-
const record3 = data[
|
|
18016
|
+
const record3 = data[path115];
|
|
18017
18017
|
if (!record3 || record3.reaped || record3.harness === harness) return;
|
|
18018
|
-
data[
|
|
18018
|
+
data[path115] = { ...record3, harness };
|
|
18019
18019
|
saveJson(REGISTRY_FILE, data);
|
|
18020
18020
|
}
|
|
18021
|
-
function forgetWorktree(
|
|
18021
|
+
function forgetWorktree(path115) {
|
|
18022
18022
|
const data = loadJson(REGISTRY_FILE);
|
|
18023
|
-
const record3 = data[
|
|
18023
|
+
const record3 = data[path115];
|
|
18024
18024
|
if (!record3 || record3.reaped) return;
|
|
18025
|
-
data[
|
|
18025
|
+
data[path115] = { ...record3, reaped: true };
|
|
18026
18026
|
saveJson(REGISTRY_FILE, data);
|
|
18027
18027
|
}
|
|
18028
18028
|
|
|
@@ -20101,9 +20101,9 @@ function toAnswers(value) {
|
|
|
20101
20101
|
function toAttachments(value) {
|
|
20102
20102
|
if (!Array.isArray(value)) return void 0;
|
|
20103
20103
|
return value.flatMap((entry) => {
|
|
20104
|
-
const { path:
|
|
20105
|
-
if (typeof
|
|
20106
|
-
const attachment = { path:
|
|
20104
|
+
const { path: path115, alt, group } = entry ?? {};
|
|
20105
|
+
if (typeof path115 !== "string" || path115 === "") return [];
|
|
20106
|
+
const attachment = { path: path115, alt: typeof alt === "string" ? alt : "" };
|
|
20107
20107
|
return [
|
|
20108
20108
|
typeof group === "string" && group !== "" ? { ...attachment, group } : attachment
|
|
20109
20109
|
];
|
|
@@ -20137,8 +20137,8 @@ function isReviewComment(value) {
|
|
|
20137
20137
|
}
|
|
20138
20138
|
function toReviewComments(value) {
|
|
20139
20139
|
if (!Array.isArray(value)) return void 0;
|
|
20140
|
-
return value.filter(isReviewComment).map(({ path:
|
|
20141
|
-
path:
|
|
20140
|
+
return value.filter(isReviewComment).map(({ path: path115, startLine, endLine, quote, note, startSide, side }) => ({
|
|
20141
|
+
path: path115,
|
|
20142
20142
|
startLine,
|
|
20143
20143
|
endLine,
|
|
20144
20144
|
quote,
|
|
@@ -21322,8 +21322,8 @@ async function recordGitRef(db, itemId2, ref) {
|
|
|
21322
21322
|
function gitRefUrl(kind, ref, cwd) {
|
|
21323
21323
|
const repo = getPreferredRemoteRepo(cwd);
|
|
21324
21324
|
if (!repo) return void 0;
|
|
21325
|
-
const
|
|
21326
|
-
return `https://github.com/${repo.org}/${repo.repo}/${
|
|
21325
|
+
const path115 = kind === "branch" ? "tree" : "commit";
|
|
21326
|
+
return `https://github.com/${repo.org}/${repo.repo}/${path115}/${ref}`;
|
|
21327
21327
|
}
|
|
21328
21328
|
|
|
21329
21329
|
// src/commands/sessions/shared/resolveSessionTranscript.ts
|
|
@@ -21677,9 +21677,9 @@ function originToSshUrl(origin) {
|
|
|
21677
21677
|
const firstSlash = origin.indexOf("/");
|
|
21678
21678
|
if (firstSlash <= 0) return null;
|
|
21679
21679
|
const host = origin.slice(0, firstSlash);
|
|
21680
|
-
const
|
|
21681
|
-
if (!
|
|
21682
|
-
return `git@${host}:${
|
|
21680
|
+
const path115 = origin.slice(firstSlash + 1);
|
|
21681
|
+
if (!path115) return null;
|
|
21682
|
+
return `git@${host}:${path115}.git`;
|
|
21683
21683
|
}
|
|
21684
21684
|
|
|
21685
21685
|
// src/commands/backlog/cloneRepo.ts
|
|
@@ -22533,44 +22533,44 @@ import { randomUUID as randomUUID10 } from "crypto";
|
|
|
22533
22533
|
// src/commands/backlog/propose/mutateLedger.ts
|
|
22534
22534
|
import { mkdirSync as mkdirSync14, readFileSync as readFileSync30, renameSync as renameSync4, writeFileSync as writeFileSync24 } from "fs";
|
|
22535
22535
|
import { dirname as dirname30 } from "path";
|
|
22536
|
-
function readLedger(
|
|
22536
|
+
function readLedger(path115) {
|
|
22537
22537
|
try {
|
|
22538
|
-
const parsed = JSON.parse(readFileSync30(
|
|
22538
|
+
const parsed = JSON.parse(readFileSync30(path115, "utf8"));
|
|
22539
22539
|
return { open: parsed.open ?? [], created: parsed.created };
|
|
22540
22540
|
} catch {
|
|
22541
22541
|
return { open: [] };
|
|
22542
22542
|
}
|
|
22543
22543
|
}
|
|
22544
|
-
function mutateLedger(
|
|
22545
|
-
const ledger = readLedger(
|
|
22544
|
+
function mutateLedger(path115, mutate) {
|
|
22545
|
+
const ledger = readLedger(path115);
|
|
22546
22546
|
mutate(ledger);
|
|
22547
|
-
mkdirSync14(dirname30(
|
|
22548
|
-
const tmp = `${
|
|
22547
|
+
mkdirSync14(dirname30(path115), { recursive: true });
|
|
22548
|
+
const tmp = `${path115}.${process.pid}.tmp`;
|
|
22549
22549
|
writeFileSync24(tmp, JSON.stringify(ledger));
|
|
22550
|
-
renameSync4(tmp,
|
|
22550
|
+
renameSync4(tmp, path115);
|
|
22551
22551
|
}
|
|
22552
22552
|
|
|
22553
22553
|
// src/commands/backlog/propose/findPredecessor.ts
|
|
22554
22554
|
var GRACE_MS2 = 5e3;
|
|
22555
22555
|
var SIBLING_WAIT_MS = 5e3;
|
|
22556
22556
|
var POLL_MS = 100;
|
|
22557
|
-
function knownPredecessor(
|
|
22558
|
-
const { created } = readLedger(
|
|
22557
|
+
function knownPredecessor(path115, startedAt) {
|
|
22558
|
+
const { created } = readLedger(path115);
|
|
22559
22559
|
if (!created) return void 0;
|
|
22560
22560
|
if (created.startedAt > startedAt) return void 0;
|
|
22561
22561
|
if (created.at < startedAt - GRACE_MS2) return void 0;
|
|
22562
22562
|
return created.itemId;
|
|
22563
22563
|
}
|
|
22564
|
-
function hasOlderOpenSibling(
|
|
22565
|
-
return readLedger(
|
|
22564
|
+
function hasOlderOpenSibling(path115, token, startedAt) {
|
|
22565
|
+
return readLedger(path115).open.some(
|
|
22566
22566
|
(p) => p.token !== token && p.startedAt <= startedAt
|
|
22567
22567
|
);
|
|
22568
22568
|
}
|
|
22569
|
-
async function findPredecessor(
|
|
22569
|
+
async function findPredecessor(path115, token, startedAt) {
|
|
22570
22570
|
const deadline = Date.now() + SIBLING_WAIT_MS;
|
|
22571
|
-
while (hasOlderOpenSibling(
|
|
22571
|
+
while (hasOlderOpenSibling(path115, token, startedAt) && Date.now() < deadline)
|
|
22572
22572
|
await new Promise((resolve35) => setTimeout(resolve35, POLL_MS));
|
|
22573
|
-
return knownPredecessor(
|
|
22573
|
+
return knownPredecessor(path115, startedAt);
|
|
22574
22574
|
}
|
|
22575
22575
|
|
|
22576
22576
|
// src/commands/backlog/propose/proposalLedgerPath.ts
|
|
@@ -22583,10 +22583,10 @@ function proposalLedgerPath(sessionId2) {
|
|
|
22583
22583
|
// src/commands/backlog/propose/trackProposal.ts
|
|
22584
22584
|
var STALE_OPEN_MS = 60 * 6e4;
|
|
22585
22585
|
function trackProposal(sessionId2) {
|
|
22586
|
-
const
|
|
22586
|
+
const path115 = proposalLedgerPath(sessionId2);
|
|
22587
22587
|
const token = randomUUID10();
|
|
22588
22588
|
const startedAt = Date.now();
|
|
22589
|
-
mutateLedger(
|
|
22589
|
+
mutateLedger(path115, (ledger) => {
|
|
22590
22590
|
ledger.open = ledger.open.filter(
|
|
22591
22591
|
(p) => startedAt - p.startedAt < STALE_OPEN_MS
|
|
22592
22592
|
);
|
|
@@ -22597,15 +22597,15 @@ function trackProposal(sessionId2) {
|
|
|
22597
22597
|
if (closed) return;
|
|
22598
22598
|
closed = true;
|
|
22599
22599
|
process.off("exit", close);
|
|
22600
|
-
mutateLedger(
|
|
22600
|
+
mutateLedger(path115, (ledger) => {
|
|
22601
22601
|
ledger.open = ledger.open.filter((p) => p.token !== token);
|
|
22602
22602
|
});
|
|
22603
22603
|
};
|
|
22604
22604
|
process.on("exit", close);
|
|
22605
22605
|
return {
|
|
22606
|
-
knownPredecessor: () => knownPredecessor(
|
|
22607
|
-
findPredecessor: () => findPredecessor(
|
|
22608
|
-
recordCreated: (itemId2) => mutateLedger(
|
|
22606
|
+
knownPredecessor: () => knownPredecessor(path115, startedAt),
|
|
22607
|
+
findPredecessor: () => findPredecessor(path115, token, startedAt),
|
|
22608
|
+
recordCreated: (itemId2) => mutateLedger(path115, (ledger) => {
|
|
22609
22609
|
ledger.created = { itemId: itemId2, at: Date.now(), startedAt };
|
|
22610
22610
|
}),
|
|
22611
22611
|
close
|
|
@@ -23758,10 +23758,10 @@ import { existsSync as existsSync53, unwatchFile, watchFile } from "fs";
|
|
|
23758
23758
|
// src/commands/backlog/readSignal.ts
|
|
23759
23759
|
import { existsSync as existsSync52, readFileSync as readFileSync33 } from "fs";
|
|
23760
23760
|
function readSignal() {
|
|
23761
|
-
const
|
|
23762
|
-
if (!
|
|
23761
|
+
const path115 = getSignalPath();
|
|
23762
|
+
if (!path115 || !existsSync52(path115)) return void 0;
|
|
23763
23763
|
try {
|
|
23764
|
-
return JSON.parse(readFileSync33(
|
|
23764
|
+
return JSON.parse(readFileSync33(path115, "utf8"));
|
|
23765
23765
|
} catch {
|
|
23766
23766
|
return void 0;
|
|
23767
23767
|
}
|
|
@@ -23972,13 +23972,13 @@ function activityPath(sessionId2) {
|
|
|
23972
23972
|
function emitActivity(activity2) {
|
|
23973
23973
|
const sessionId2 = process.env.ASSIST_ACTIVITY_ID;
|
|
23974
23974
|
if (!sessionId2) return;
|
|
23975
|
-
const
|
|
23976
|
-
mkdirSync17(dirname31(
|
|
23977
|
-
writeFileSync27(
|
|
23975
|
+
const path115 = activityPath(sessionId2);
|
|
23976
|
+
mkdirSync17(dirname31(path115), { recursive: true });
|
|
23977
|
+
writeFileSync27(path115, JSON.stringify({ ...activity2, startedAt: Date.now() }));
|
|
23978
23978
|
}
|
|
23979
|
-
function readActivity(
|
|
23979
|
+
function readActivity(path115) {
|
|
23980
23980
|
try {
|
|
23981
|
-
return JSON.parse(readFileSync34(
|
|
23981
|
+
return JSON.parse(readFileSync34(path115, "utf8"));
|
|
23982
23982
|
} catch {
|
|
23983
23983
|
return void 0;
|
|
23984
23984
|
}
|
|
@@ -23988,15 +23988,15 @@ function reconcileActivity(sessionId2, activity2) {
|
|
|
23988
23988
|
removeActivity(sessionId2);
|
|
23989
23989
|
return;
|
|
23990
23990
|
}
|
|
23991
|
-
const
|
|
23992
|
-
mkdirSync17(dirname31(
|
|
23993
|
-
writeFileSync27(
|
|
23991
|
+
const path115 = activityPath(sessionId2);
|
|
23992
|
+
mkdirSync17(dirname31(path115), { recursive: true });
|
|
23993
|
+
writeFileSync27(path115, JSON.stringify(activity2));
|
|
23994
23994
|
}
|
|
23995
23995
|
function writeActivityIfAbsent(sessionId2, activity2) {
|
|
23996
|
-
const
|
|
23997
|
-
mkdirSync17(dirname31(
|
|
23996
|
+
const path115 = activityPath(sessionId2);
|
|
23997
|
+
mkdirSync17(dirname31(path115), { recursive: true });
|
|
23998
23998
|
try {
|
|
23999
|
-
writeFileSync27(
|
|
23999
|
+
writeFileSync27(path115, JSON.stringify(activity2), { flag: "wx" });
|
|
24000
24000
|
return true;
|
|
24001
24001
|
} catch (error) {
|
|
24002
24002
|
if (error.code === "EEXIST") return false;
|
|
@@ -26325,9 +26325,9 @@ function isGhGraphqlIssueMutation(command) {
|
|
|
26325
26325
|
(m) => ISSUE_MUTATION.test(readOrEmpty(m[1]))
|
|
26326
26326
|
);
|
|
26327
26327
|
}
|
|
26328
|
-
function readOrEmpty(
|
|
26328
|
+
function readOrEmpty(path115) {
|
|
26329
26329
|
try {
|
|
26330
|
-
return readFileSync35(
|
|
26330
|
+
return readFileSync35(path115, "utf8");
|
|
26331
26331
|
} catch {
|
|
26332
26332
|
return "";
|
|
26333
26333
|
}
|
|
@@ -26464,13 +26464,13 @@ function findBuiltinDenyRaw(rawCommand) {
|
|
|
26464
26464
|
|
|
26465
26465
|
// src/commands/cliHook/findRestrictedPathDeny.ts
|
|
26466
26466
|
var RESTRICTED_PATHS = [".assist/restricted"];
|
|
26467
|
-
function restrictedPathRegex(
|
|
26468
|
-
const pattern2 =
|
|
26467
|
+
function restrictedPathRegex(path115) {
|
|
26468
|
+
const pattern2 = path115.split("/").map((segment) => segment.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`)).join(String.raw`[/\\]`);
|
|
26469
26469
|
return new RegExp(pattern2);
|
|
26470
26470
|
}
|
|
26471
|
-
var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((
|
|
26472
|
-
path:
|
|
26473
|
-
regex: restrictedPathRegex(
|
|
26471
|
+
var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((path115) => ({
|
|
26472
|
+
path: path115,
|
|
26473
|
+
regex: restrictedPathRegex(path115)
|
|
26474
26474
|
}));
|
|
26475
26475
|
function findRestrictedPathDenyRaw(rawCommand) {
|
|
26476
26476
|
const rule = RESTRICTED_PATH_RULES.find(
|
|
@@ -26690,9 +26690,9 @@ var __dirname4 = dirname32(__filename3);
|
|
|
26690
26690
|
function packageRoot() {
|
|
26691
26691
|
return __dirname4;
|
|
26692
26692
|
}
|
|
26693
|
-
function readLines(
|
|
26694
|
-
if (!existsSync55(
|
|
26695
|
-
return readFileSync36(
|
|
26693
|
+
function readLines(path115) {
|
|
26694
|
+
if (!existsSync55(path115)) return [];
|
|
26695
|
+
return readFileSync36(path115, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
26696
26696
|
}
|
|
26697
26697
|
var cachedReads;
|
|
26698
26698
|
var cachedWrites;
|
|
@@ -27034,9 +27034,9 @@ import { relative as relative7, resolve as resolve21 } from "path";
|
|
|
27034
27034
|
var SCHEMA_LOCK_REASON = "Database schema files (src/shared/db/migrations/migrationNNNN*.ts, src/shared/db/migrations.ts, src/shared/db/schema.ts and any src/shared/db/*.ts that defines a pgTable) are locked: a schema change needs the user's sign-off (see src/shared/db/CLAUDE.md). Confirm the schema change with the user first, then run `assist schema unlock` to request a PIN and wait for the user to confirm it with `assist schema confirm <pin>` before retrying. In a backlog item session the unlock lasts for the current phase on this harness; otherwise it lasts for this conversation only.";
|
|
27035
27035
|
var FIXED_SCHEMA_PATH = /^src\/shared\/db\/(?:migrations\/migration\d{4}[^/]*\.ts|migrations\.ts|schema\.ts)$/;
|
|
27036
27036
|
var DB_MODULE = /^src\/shared\/db\/[^/]+\.ts$/;
|
|
27037
|
-
function readOrEmpty2(
|
|
27037
|
+
function readOrEmpty2(path115) {
|
|
27038
27038
|
try {
|
|
27039
|
-
return readFileSync38(
|
|
27039
|
+
return readFileSync38(path115, "utf8");
|
|
27040
27040
|
} catch {
|
|
27041
27041
|
return "";
|
|
27042
27042
|
}
|
|
@@ -27104,9 +27104,9 @@ function findSchemaPathDeny(toolName, rawCommand, root2 = getProjectRoot()) {
|
|
|
27104
27104
|
|
|
27105
27105
|
// src/commands/editHook/decideDocsGuard.ts
|
|
27106
27106
|
async function decideDocsGuard({
|
|
27107
|
-
path:
|
|
27107
|
+
path: path115
|
|
27108
27108
|
}) {
|
|
27109
|
-
if (!isDocsPath(
|
|
27109
|
+
if (!isDocsPath(path115)) return void 0;
|
|
27110
27110
|
return await isDocsLocked() ? DOCS_LOCK_REASON : void 0;
|
|
27111
27111
|
}
|
|
27112
27112
|
|
|
@@ -27140,10 +27140,10 @@ function getSchemaSessionApprovalPath(scope) {
|
|
|
27140
27140
|
}
|
|
27141
27141
|
|
|
27142
27142
|
// src/commands/schema/isSchemaLocked.ts
|
|
27143
|
-
function approvalMatches(
|
|
27143
|
+
function approvalMatches(path115, identity) {
|
|
27144
27144
|
try {
|
|
27145
27145
|
const approval = JSON.parse(
|
|
27146
|
-
readFileSync39(
|
|
27146
|
+
readFileSync39(path115, "utf8")
|
|
27147
27147
|
);
|
|
27148
27148
|
const conversation = approval.conversationId ?? approval.claudeSessionId;
|
|
27149
27149
|
if (approval.harness !== void 0 && approval.harness !== identity.harness)
|
|
@@ -27156,8 +27156,8 @@ function approvalMatches(path114, identity) {
|
|
|
27156
27156
|
function hasSessionApproval(identity) {
|
|
27157
27157
|
const { harness, conversationId } = identity;
|
|
27158
27158
|
if (!conversationId) return false;
|
|
27159
|
-
const
|
|
27160
|
-
return
|
|
27159
|
+
const path115 = getSchemaSessionApprovalPath({ harness, conversationId });
|
|
27160
|
+
return path115 !== void 0 && existsSync57(path115) && approvalMatches(path115, identity);
|
|
27161
27161
|
}
|
|
27162
27162
|
async function isSchemaLocked(identity = currentExecutionIdentity()) {
|
|
27163
27163
|
if (!identity) return false;
|
|
@@ -27177,8 +27177,8 @@ async function isSchemaLocked(identity = currentExecutionIdentity()) {
|
|
|
27177
27177
|
}
|
|
27178
27178
|
|
|
27179
27179
|
// src/commands/editHook/decideSchemaGuard.ts
|
|
27180
|
-
async function decideSchemaGuard({ path:
|
|
27181
|
-
if (!isSchemaPath(
|
|
27180
|
+
async function decideSchemaGuard({ path: path115, contents }, identity) {
|
|
27181
|
+
if (!isSchemaPath(path115, contents)) return void 0;
|
|
27182
27182
|
return await isSchemaLocked(identity) ? SCHEMA_LOCK_REASON : void 0;
|
|
27183
27183
|
}
|
|
27184
27184
|
|
|
@@ -27471,14 +27471,14 @@ function showProgress(p, label) {
|
|
|
27471
27471
|
const pct = Math.round(p.done / p.total * 100);
|
|
27472
27472
|
process.stderr.write(`\r\x1B[K[${pct}%] Scanning ${label}...`);
|
|
27473
27473
|
}
|
|
27474
|
-
async function resolveCommand2(cli,
|
|
27475
|
-
showProgress(p,
|
|
27476
|
-
const subHelp = await runHelp([cli, ...
|
|
27474
|
+
async function resolveCommand2(cli, path115, description, depth, p) {
|
|
27475
|
+
showProgress(p, path115.join(" "));
|
|
27476
|
+
const subHelp = await runHelp([cli, ...path115]);
|
|
27477
27477
|
if (!subHelp || !hasSubcommands(subHelp)) {
|
|
27478
|
-
return [{ path:
|
|
27478
|
+
return [{ path: path115, description }];
|
|
27479
27479
|
}
|
|
27480
|
-
const children = await discoverAt(cli,
|
|
27481
|
-
return children.length > 0 ? children : [{ path:
|
|
27480
|
+
const children = await discoverAt(cli, path115, depth + 1, p);
|
|
27481
|
+
return children.length > 0 ? children : [{ path: path115, description }];
|
|
27482
27482
|
}
|
|
27483
27483
|
async function discoverAt(cli, parentPath, depth, p) {
|
|
27484
27484
|
if (depth > SAFETY_DEPTH) return [];
|
|
@@ -27626,9 +27626,9 @@ function logPath(cli) {
|
|
|
27626
27626
|
return join65(homedir22(), ".assist", `cli-discover-${safeName}.log`);
|
|
27627
27627
|
}
|
|
27628
27628
|
function readCache(cli) {
|
|
27629
|
-
const
|
|
27630
|
-
if (!existsSync58(
|
|
27631
|
-
return readFileSync40(
|
|
27629
|
+
const path115 = logPath(cli);
|
|
27630
|
+
if (!existsSync58(path115)) return void 0;
|
|
27631
|
+
return readFileSync40(path115, "utf8");
|
|
27632
27632
|
}
|
|
27633
27633
|
function writeCache(cli, output) {
|
|
27634
27634
|
const dir = join65(homedir22(), ".assist");
|
|
@@ -27808,9 +27808,9 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
27808
27808
|
}
|
|
27809
27809
|
const cutoff = Date.now() - STALE_AFTER_MS;
|
|
27810
27810
|
for (const entry of entries) {
|
|
27811
|
-
const
|
|
27811
|
+
const path115 = join66(dir, entry);
|
|
27812
27812
|
try {
|
|
27813
|
-
if (statSync9(
|
|
27813
|
+
if (statSync9(path115).mtimeMs < cutoff) unlinkSync8(path115);
|
|
27814
27814
|
} catch {
|
|
27815
27815
|
continue;
|
|
27816
27816
|
}
|
|
@@ -27820,10 +27820,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
27820
27820
|
// src/commands/codeComment/readPinState.ts
|
|
27821
27821
|
import { existsSync as existsSync59, readFileSync as readFileSync41 } from "fs";
|
|
27822
27822
|
function readPinState(pin2) {
|
|
27823
|
-
const
|
|
27824
|
-
if (!existsSync59(
|
|
27823
|
+
const path115 = getPinStatePath(pin2);
|
|
27824
|
+
if (!existsSync59(path115)) return void 0;
|
|
27825
27825
|
try {
|
|
27826
|
-
const state = JSON.parse(readFileSync41(
|
|
27826
|
+
const state = JSON.parse(readFileSync41(path115, "utf8"));
|
|
27827
27827
|
if (state.pin !== pin2) return void 0;
|
|
27828
27828
|
return state;
|
|
27829
27829
|
} catch {
|
|
@@ -28291,8 +28291,8 @@ function findUnmergedPaths() {
|
|
|
28291
28291
|
}
|
|
28292
28292
|
const found = /* @__PURE__ */ new Set();
|
|
28293
28293
|
for (const line of output.split("\n")) {
|
|
28294
|
-
const
|
|
28295
|
-
if (
|
|
28294
|
+
const path115 = line.split(" ")[1];
|
|
28295
|
+
if (path115) found.add(path115.trim());
|
|
28296
28296
|
}
|
|
28297
28297
|
return [...found];
|
|
28298
28298
|
}
|
|
@@ -29462,8 +29462,8 @@ function diffRepoConfigLeaves(current2, incoming) {
|
|
|
29462
29462
|
}
|
|
29463
29463
|
function leaves(node, prefix2 = "") {
|
|
29464
29464
|
return Object.entries(node).flatMap(([key, value]) => {
|
|
29465
|
-
const
|
|
29466
|
-
return isPlainObject4(value) && Object.keys(value).length > 0 ? leaves(value,
|
|
29465
|
+
const path115 = prefix2 ? `${prefix2}.${key}` : key;
|
|
29466
|
+
return isPlainObject4(value) && Object.keys(value).length > 0 ? leaves(value, path115) : [[path115, value]];
|
|
29467
29467
|
});
|
|
29468
29468
|
}
|
|
29469
29469
|
function isPlainObject4(value) {
|
|
@@ -30088,10 +30088,10 @@ async function browserSnapshot(options2) {
|
|
|
30088
30088
|
op: "snapshot",
|
|
30089
30089
|
url: options2.url
|
|
30090
30090
|
});
|
|
30091
|
-
const
|
|
30092
|
-
mkdirSync21(dirname33(
|
|
30093
|
-
writeFileSync32(
|
|
30094
|
-
console.log(`snapshot: ${
|
|
30091
|
+
const path115 = snapshotPath(result.tabUrl, /* @__PURE__ */ new Date());
|
|
30092
|
+
mkdirSync21(dirname33(path115), { recursive: true });
|
|
30093
|
+
writeFileSync32(path115, result.html);
|
|
30094
|
+
console.log(`snapshot: ${path115}`);
|
|
30095
30095
|
}
|
|
30096
30096
|
|
|
30097
30097
|
// src/commands/browser/formatExtensionUpdate.ts
|
|
@@ -30266,9 +30266,9 @@ async function loadPath(source) {
|
|
|
30266
30266
|
}
|
|
30267
30267
|
}
|
|
30268
30268
|
async function extension() {
|
|
30269
|
-
const
|
|
30269
|
+
const path115 = await loadPath(extensionDir());
|
|
30270
30270
|
console.log(chalk153.bold("assist \u2014 GitHub browser extension"));
|
|
30271
|
-
console.log(chalk153.dim(`load the unpacked extension from ${
|
|
30271
|
+
console.log(chalk153.dim(`load the unpacked extension from ${path115}`));
|
|
30272
30272
|
}
|
|
30273
30273
|
|
|
30274
30274
|
// src/commands/extension/printExtensionUrl.ts
|
|
@@ -30363,7 +30363,7 @@ async function stageExtension(source, staging, version2) {
|
|
|
30363
30363
|
await mkdir5(staging, { recursive: true });
|
|
30364
30364
|
await cp3(source, staging, {
|
|
30365
30365
|
recursive: true,
|
|
30366
|
-
filter: (
|
|
30366
|
+
filter: (path115) => basename18(path115) !== "updates.json"
|
|
30367
30367
|
});
|
|
30368
30368
|
const manifest = join71(staging, "manifest.json");
|
|
30369
30369
|
const stamped = stampManifestVersion(
|
|
@@ -30444,10 +30444,10 @@ async function signExtension() {
|
|
|
30444
30444
|
return;
|
|
30445
30445
|
}
|
|
30446
30446
|
await writeUpdateManifest(source, ARTIFACTS_DIR, version2);
|
|
30447
|
-
const
|
|
30447
|
+
const path115 = await signedAddonInstallPath(
|
|
30448
30448
|
await copySignedXpi(xpi, ARTIFACTS_DIR)
|
|
30449
30449
|
);
|
|
30450
|
-
console.log(chalk156.dim(`install the signed add-on from ${
|
|
30450
|
+
console.log(chalk156.dim(`install the signed add-on from ${path115}`));
|
|
30451
30451
|
}
|
|
30452
30452
|
|
|
30453
30453
|
// src/commands/registerExtension.ts
|
|
@@ -30711,17 +30711,17 @@ function devEntryPath(repoName, week, devDir) {
|
|
|
30711
30711
|
function asString(value) {
|
|
30712
30712
|
return value === void 0 || value === null ? null : String(value);
|
|
30713
30713
|
}
|
|
30714
|
-
function readFrontmatter(
|
|
30714
|
+
function readFrontmatter(path115) {
|
|
30715
30715
|
try {
|
|
30716
|
-
const match = readFileSync45(
|
|
30716
|
+
const match = readFileSync45(path115, "utf8").match(/^---\n([\s\S]*?)\n---/);
|
|
30717
30717
|
return match ? parseYaml3(match[1]) ?? {} : null;
|
|
30718
30718
|
} catch {
|
|
30719
30719
|
return null;
|
|
30720
30720
|
}
|
|
30721
30721
|
}
|
|
30722
30722
|
function loadDevEntry(repoName, week, devDir) {
|
|
30723
|
-
const
|
|
30724
|
-
const frontmatter2 = readFrontmatter(
|
|
30723
|
+
const path115 = devEntryPath(repoName, week, devDir);
|
|
30724
|
+
const frontmatter2 = readFrontmatter(path115);
|
|
30725
30725
|
if (!frontmatter2) return null;
|
|
30726
30726
|
const versions = frontmatter2.versions;
|
|
30727
30727
|
return {
|
|
@@ -31117,11 +31117,11 @@ function fail7(message4) {
|
|
|
31117
31117
|
console.error(chalk166.red(message4));
|
|
31118
31118
|
process.exit(1);
|
|
31119
31119
|
}
|
|
31120
|
-
function readEntry(
|
|
31120
|
+
function readEntry(path115) {
|
|
31121
31121
|
try {
|
|
31122
|
-
return readFileSync47(
|
|
31122
|
+
return readFileSync47(path115, "utf8");
|
|
31123
31123
|
} catch {
|
|
31124
|
-
fail7(`No dev entry at ${
|
|
31124
|
+
fail7(`No dev entry at ${path115}`);
|
|
31125
31125
|
}
|
|
31126
31126
|
}
|
|
31127
31127
|
function resolveValue(permalink, skipped) {
|
|
@@ -31138,11 +31138,11 @@ function resolveValue(permalink, skipped) {
|
|
|
31138
31138
|
function posted(week, permalink, options2 = {}) {
|
|
31139
31139
|
if (!isValidWeek(week)) fail7("Invalid week. Use YYYY-Www (e.g. 2026-W33)");
|
|
31140
31140
|
const value = resolveValue(permalink, options2.skip === true);
|
|
31141
|
-
const
|
|
31142
|
-
const updated2 = setFrontmatterSlack(readEntry(
|
|
31143
|
-
if (updated2 === null) fail7(`${
|
|
31144
|
-
writeFileSync34(
|
|
31145
|
-
console.log(chalk166.green(`Recorded slack: ${value} in ${
|
|
31141
|
+
const path115 = devEntryPath(getRepoName(), week, resolveDevDir());
|
|
31142
|
+
const updated2 = setFrontmatterSlack(readEntry(path115), value);
|
|
31143
|
+
if (updated2 === null) fail7(`${path115} has no YAML frontmatter`);
|
|
31144
|
+
writeFileSync34(path115, updated2);
|
|
31145
|
+
console.log(chalk166.green(`Recorded slack: ${value} in ${path115}`));
|
|
31146
31146
|
}
|
|
31147
31147
|
|
|
31148
31148
|
// src/commands/devlog/skip.ts
|
|
@@ -31269,7 +31269,7 @@ async function previewSlackThreadParts({
|
|
|
31269
31269
|
`Approved for ${target}. The ${bodies.length} bodies to post, in thread order, are at:`
|
|
31270
31270
|
);
|
|
31271
31271
|
paths.forEach(
|
|
31272
|
-
(
|
|
31272
|
+
(path115, index3) => console.log(`${index3 + 1}/${paths.length} ${path115}`)
|
|
31273
31273
|
);
|
|
31274
31274
|
console.log(
|
|
31275
31275
|
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.`
|
|
@@ -31330,10 +31330,10 @@ function devlogSlackChannel() {
|
|
|
31330
31330
|
import { readFileSync as readFileSync49 } from "fs";
|
|
31331
31331
|
import { parse as parseYaml4 } from "yaml";
|
|
31332
31332
|
var FRONTMATTER2 = /^---\n([\s\S]*?)\n---\n?([\s\S]*)$/;
|
|
31333
|
-
function readDevEntryFile(
|
|
31333
|
+
function readDevEntryFile(path115) {
|
|
31334
31334
|
let contents;
|
|
31335
31335
|
try {
|
|
31336
|
-
contents = readFileSync49(
|
|
31336
|
+
contents = readFileSync49(path115, "utf8");
|
|
31337
31337
|
} catch {
|
|
31338
31338
|
return null;
|
|
31339
31339
|
}
|
|
@@ -31471,9 +31471,9 @@ async function slack2(week) {
|
|
|
31471
31471
|
}
|
|
31472
31472
|
if (!isValidWeek(week)) fail8("Invalid week. Use YYYY-Www (e.g. 2026-W33)");
|
|
31473
31473
|
const channel = devlogSlackChannel();
|
|
31474
|
-
const
|
|
31475
|
-
const entry = readDevEntryFile(
|
|
31476
|
-
if (!entry) fail8(`No dev entry for ${week} at ${
|
|
31474
|
+
const path115 = devEntryPath(repoName, week, devDir);
|
|
31475
|
+
const entry = readDevEntryFile(path115);
|
|
31476
|
+
if (!entry) fail8(`No dev entry for ${week} at ${path115}`);
|
|
31477
31477
|
if (entry.slack) fail8(`${week} is already posted: slack: ${entry.slack}`);
|
|
31478
31478
|
const parts2 = renderDevlogSlackParts(
|
|
31479
31479
|
entry,
|
|
@@ -31583,10 +31583,10 @@ async function write() {
|
|
|
31583
31583
|
}
|
|
31584
31584
|
const devDir = resolveDevDir();
|
|
31585
31585
|
const repoName = getRepoName();
|
|
31586
|
-
const
|
|
31587
|
-
mkdirSync25(dirname34(
|
|
31588
|
-
writeFileSync38(
|
|
31589
|
-
console.log(chalk169.green(`Wrote ${
|
|
31586
|
+
const path115 = devEntryPath(repoName, result.data.week, devDir);
|
|
31587
|
+
mkdirSync25(dirname34(path115), { recursive: true });
|
|
31588
|
+
writeFileSync38(path115, formatDevEntry(repoName, result.data));
|
|
31589
|
+
console.log(chalk169.green(`Wrote ${path115}`));
|
|
31590
31590
|
}
|
|
31591
31591
|
|
|
31592
31592
|
// src/commands/devlog/registerDevlogEntryCommands.ts
|
|
@@ -31792,10 +31792,10 @@ function isPositiveInteger(value) {
|
|
|
31792
31792
|
return Number.isInteger(value) && value > 0;
|
|
31793
31793
|
}
|
|
31794
31794
|
function readDocsUnlockPinState(pin2) {
|
|
31795
|
-
const
|
|
31796
|
-
if (!existsSync65(
|
|
31795
|
+
const path115 = getDocsUnlockPinPath(pin2);
|
|
31796
|
+
if (!existsSync65(path115)) return void 0;
|
|
31797
31797
|
try {
|
|
31798
|
-
const state = JSON.parse(readFileSync50(
|
|
31798
|
+
const state = JSON.parse(readFileSync50(path115, "utf8"));
|
|
31799
31799
|
if (state.pin !== pin2) return void 0;
|
|
31800
31800
|
if (!isPositiveInteger(state.itemId)) return void 0;
|
|
31801
31801
|
if (!isPositiveInteger(state.phase)) return void 0;
|
|
@@ -31849,15 +31849,15 @@ async function issueUnlockPin({
|
|
|
31849
31849
|
const pin2 = randomInt2(0, 1e3).toString().padStart(3, "0");
|
|
31850
31850
|
mkdirSync26(getRestrictedDir(), { recursive: true });
|
|
31851
31851
|
sweepRestrictedDir();
|
|
31852
|
-
const
|
|
31853
|
-
writeFileSync39(
|
|
31852
|
+
const path115 = pinPath(pin2);
|
|
31853
|
+
writeFileSync39(path115, JSON.stringify({ ...state, pin: pin2 }));
|
|
31854
31854
|
const delivery = await deliverPinNotification({
|
|
31855
31855
|
area,
|
|
31856
31856
|
pin: pin2,
|
|
31857
31857
|
title: `assist ${area} unlock: ${label}`,
|
|
31858
31858
|
message: `Pin ${pin2} \u2014 run: assist ${area} confirm ${pin2}`
|
|
31859
31859
|
});
|
|
31860
|
-
if (!delivery.delivered) unlinkSync11(
|
|
31860
|
+
if (!delivery.delivered) unlinkSync11(path115);
|
|
31861
31861
|
return delivery;
|
|
31862
31862
|
}
|
|
31863
31863
|
|
|
@@ -31955,10 +31955,10 @@ async function approveItemPhase({
|
|
|
31955
31955
|
}
|
|
31956
31956
|
function approveSession({ harness, conversationId }) {
|
|
31957
31957
|
const scope = { harness, conversationId };
|
|
31958
|
-
const
|
|
31959
|
-
if (!
|
|
31958
|
+
const path115 = getSchemaSessionApprovalPath(scope);
|
|
31959
|
+
if (!path115) return;
|
|
31960
31960
|
mkdirSync27(getSchemaSessionApprovalDir(), { recursive: true });
|
|
31961
|
-
writeFileSync40(
|
|
31961
|
+
writeFileSync40(path115, JSON.stringify(scope));
|
|
31962
31962
|
console.log(
|
|
31963
31963
|
chalk175.green(
|
|
31964
31964
|
`Approved schema changes for ${schemaHarnessLabel(harness)} session ${conversationId}. It may edit and commit database schema files until the session ends.`
|
|
@@ -32001,10 +32001,10 @@ function toState(raw) {
|
|
|
32001
32001
|
return sessionState(raw);
|
|
32002
32002
|
}
|
|
32003
32003
|
function readSchemaUnlockPinState(pin2) {
|
|
32004
|
-
const
|
|
32005
|
-
if (!existsSync66(
|
|
32004
|
+
const path115 = getSchemaUnlockPinPath(pin2);
|
|
32005
|
+
if (!existsSync66(path115)) return void 0;
|
|
32006
32006
|
try {
|
|
32007
|
-
const raw = JSON.parse(readFileSync51(
|
|
32007
|
+
const raw = JSON.parse(readFileSync51(path115, "utf8"));
|
|
32008
32008
|
if (raw.pin !== pin2) return void 0;
|
|
32009
32009
|
return toState(raw);
|
|
32010
32010
|
} catch {
|
|
@@ -34343,8 +34343,8 @@ function collectLabels(value, previous) {
|
|
|
34343
34343
|
import { extname as extname3 } from "path";
|
|
34344
34344
|
|
|
34345
34345
|
// src/commands/prs/screenshotReference.ts
|
|
34346
|
-
function screenshotReference({ path:
|
|
34347
|
-
const target = /\s/.test(
|
|
34346
|
+
function screenshotReference({ path: path115, alt }) {
|
|
34347
|
+
const target = /\s/.test(path115) ? `<${path115}>` : path115;
|
|
34348
34348
|
return ``;
|
|
34349
34349
|
}
|
|
34350
34350
|
|
|
@@ -34801,7 +34801,7 @@ async function reviewProposedIssue(title, body, metadata2 = []) {
|
|
|
34801
34801
|
|
|
34802
34802
|
// src/commands/prs/attachArgs.ts
|
|
34803
34803
|
function attachArgs(attachments) {
|
|
34804
|
-
return attachments.flatMap(({ path:
|
|
34804
|
+
return attachments.flatMap(({ path: path115 }) => ["--attach", path115]);
|
|
34805
34805
|
}
|
|
34806
34806
|
|
|
34807
34807
|
// src/commands/prs/runGhWithAttachments.ts
|
|
@@ -34812,8 +34812,8 @@ import { basename as basename20 } from "path";
|
|
|
34812
34812
|
import { rmSync as rmSync5 } from "fs";
|
|
34813
34813
|
import { dirname as dirname36 } from "path";
|
|
34814
34814
|
function removeStagedAttachments(attachments) {
|
|
34815
|
-
for (const { path:
|
|
34816
|
-
const dir = dirname36(
|
|
34815
|
+
for (const { path: path115 } of attachments) {
|
|
34816
|
+
const dir = dirname36(path115);
|
|
34817
34817
|
if (!isStagedAttachmentPath(dir)) continue;
|
|
34818
34818
|
rmSync5(dir, { recursive: true, force: true });
|
|
34819
34819
|
}
|
|
@@ -34823,7 +34823,7 @@ function removeStagedAttachments(attachments) {
|
|
|
34823
34823
|
var PLACED_URL = /https:\/\/\S+\/(pull|issues)\/\d+/;
|
|
34824
34824
|
function reportPartialFailure(attachments, stderr) {
|
|
34825
34825
|
const failed3 = attachments.filter(
|
|
34826
|
-
({ path:
|
|
34826
|
+
({ path: path115 }) => stderr.includes(path115) || stderr.includes(basename20(path115))
|
|
34827
34827
|
);
|
|
34828
34828
|
const named = failed3.length > 0 ? failed3 : attachments;
|
|
34829
34829
|
console.error(
|
|
@@ -36202,13 +36202,13 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
|
36202
36202
|
const registered = new Set(listWorktreePaths(clone));
|
|
36203
36203
|
const branches = new Set(listLocalBranches(clone));
|
|
36204
36204
|
const isTaken = (candidate) => registered.has(candidate) || existsSync71(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename22(candidate));
|
|
36205
|
-
const
|
|
36206
|
-
const ready = addWorktree(clone,
|
|
36205
|
+
const path115 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
|
|
36206
|
+
const ready = addWorktree(clone, path115, strategy.trunk);
|
|
36207
36207
|
ready.catch(() => {
|
|
36208
36208
|
});
|
|
36209
|
-
return { path:
|
|
36209
|
+
return { path: path115, ready };
|
|
36210
36210
|
}
|
|
36211
|
-
async function addWorktree(clone,
|
|
36211
|
+
async function addWorktree(clone, path115, trunk) {
|
|
36212
36212
|
const fetched = await gitResult(
|
|
36213
36213
|
clone,
|
|
36214
36214
|
["fetch", "--quiet"],
|
|
@@ -36224,13 +36224,13 @@ async function addWorktree(clone, path114, trunk) {
|
|
|
36224
36224
|
"add",
|
|
36225
36225
|
start2.track ? "--track" : "--no-track",
|
|
36226
36226
|
"-b",
|
|
36227
|
-
basename22(
|
|
36228
|
-
|
|
36227
|
+
basename22(path115),
|
|
36228
|
+
path115,
|
|
36229
36229
|
start2.ref
|
|
36230
36230
|
]);
|
|
36231
|
-
recordWorktree(
|
|
36231
|
+
recordWorktree(path115, clone, getCachedOrigin(clone));
|
|
36232
36232
|
daemonLog(
|
|
36233
|
-
start2.track ? `worktree allocated ${
|
|
36233
|
+
start2.track ? `worktree allocated ${path115} (branch ${basename22(path115)} tracking ${start2.ref}) for clone ${clone}` : `worktree allocated ${path115} (branch ${basename22(path115)} off ${start2.ref}, no mainline tracking) for clone ${clone}`
|
|
36234
36234
|
);
|
|
36235
36235
|
}
|
|
36236
36236
|
|
|
@@ -36275,16 +36275,16 @@ function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
|
|
|
36275
36275
|
`worktree.enabled is off for ${repoRoot3}, so every session shares this tree`
|
|
36276
36276
|
);
|
|
36277
36277
|
const clone = canonicalTreePath(mainWorktree(repoRoot3) ?? repoRoot3);
|
|
36278
|
-
const { path:
|
|
36278
|
+
const { path: path115, ready } = createWorktree(
|
|
36279
36279
|
clone,
|
|
36280
36280
|
{ root: cfg.root, trunk: cfg.trunk },
|
|
36281
36281
|
boundTreeRoots2,
|
|
36282
36282
|
options2.replacesTree
|
|
36283
36283
|
);
|
|
36284
36284
|
daemonLog(
|
|
36285
|
-
`session spilled out of the clone ${clone} into ${
|
|
36285
|
+
`session spilled out of the clone ${clone} into ${path115}: worktree.enabled is on, so every session gets its own worktree`
|
|
36286
36286
|
);
|
|
36287
|
-
return { cwd:
|
|
36287
|
+
return { cwd: path115, kind: "worktree", created: true, clone, ready };
|
|
36288
36288
|
}
|
|
36289
36289
|
|
|
36290
36290
|
// src/commands/sessions/daemon/describePersistedSession.ts
|
|
@@ -36819,12 +36819,12 @@ async function reportCwdToDaemon(cwd) {
|
|
|
36819
36819
|
|
|
36820
36820
|
// src/commands/sessions/daemon/worktree/worktreeWithBranch.ts
|
|
36821
36821
|
function worktreeWithBranch(listing, branch2) {
|
|
36822
|
-
let
|
|
36822
|
+
let path115 = null;
|
|
36823
36823
|
for (const line of listing.split("\n")) {
|
|
36824
36824
|
const trimmed = line.trim();
|
|
36825
36825
|
if (trimmed.startsWith("worktree "))
|
|
36826
|
-
|
|
36827
|
-
else if (trimmed === `branch refs/heads/${branch2}`) return
|
|
36826
|
+
path115 = trimmed.slice("worktree ".length).trim();
|
|
36827
|
+
else if (trimmed === `branch refs/heads/${branch2}`) return path115;
|
|
36828
36828
|
}
|
|
36829
36829
|
return null;
|
|
36830
36830
|
}
|
|
@@ -36834,8 +36834,8 @@ function worktreeHoldingBranch(cwd, branch2) {
|
|
|
36834
36834
|
const listing = gitSyncOrNull(cwd, ["worktree", "list", "--porcelain"]);
|
|
36835
36835
|
if (!listing) return null;
|
|
36836
36836
|
const here = gitSyncOrNull(cwd, ["rev-parse", "--show-toplevel"]);
|
|
36837
|
-
const
|
|
36838
|
-
return
|
|
36837
|
+
const path115 = worktreeWithBranch(listing, branch2);
|
|
36838
|
+
return path115 && path115 !== here ? path115 : null;
|
|
36839
36839
|
}
|
|
36840
36840
|
|
|
36841
36841
|
// src/commands/review/failCheckout.ts
|
|
@@ -38052,9 +38052,9 @@ function parseRscRows(flight) {
|
|
|
38052
38052
|
}
|
|
38053
38053
|
function makeRscResolver(rows) {
|
|
38054
38054
|
return (ref) => {
|
|
38055
|
-
const [id, ...
|
|
38055
|
+
const [id, ...path115] = ref.slice(1).replace(/^[L@]/, "").split(":");
|
|
38056
38056
|
let v = rows[id];
|
|
38057
|
-
for (const key of
|
|
38057
|
+
for (const key of path115) {
|
|
38058
38058
|
if (v == null || typeof v !== "object") return void 0;
|
|
38059
38059
|
v = v[key];
|
|
38060
38060
|
}
|
|
@@ -38843,18 +38843,18 @@ function validateLine(line) {
|
|
|
38843
38843
|
process.exit(1);
|
|
38844
38844
|
}
|
|
38845
38845
|
}
|
|
38846
|
-
async function comment2(
|
|
38846
|
+
async function comment2(path115, line, body, options2 = {}) {
|
|
38847
38847
|
const { startLine, skipPreview } = options2;
|
|
38848
38848
|
validateBody(body);
|
|
38849
38849
|
validateLine(line);
|
|
38850
38850
|
if (startLine !== void 0) validateLine(startLine);
|
|
38851
38851
|
const range = startLine !== void 0 ? `${startLine}-${line}` : `${line}`;
|
|
38852
38852
|
if (!skipPreview)
|
|
38853
|
-
await reviewProposedPrComment(`Comment on ${
|
|
38853
|
+
await reviewProposedPrComment(`Comment on ${path115}:${range}`, body, null);
|
|
38854
38854
|
try {
|
|
38855
38855
|
const prId = getCurrentPrNodeId();
|
|
38856
|
-
postReviewComment({ prId, body, path:
|
|
38857
|
-
console.log(`Added review comment on ${
|
|
38856
|
+
postReviewComment({ prId, body, path: path115, line, startLine });
|
|
38857
|
+
console.log(`Added review comment on ${path115}:${range}`);
|
|
38858
38858
|
} catch (error) {
|
|
38859
38859
|
if (isGhNotInstalled(error)) {
|
|
38860
38860
|
console.error("Error: GitHub CLI (gh) is not installed.");
|
|
@@ -39693,9 +39693,9 @@ function registerPrsComments(prsCommand) {
|
|
|
39693
39693
|
internalCommand(
|
|
39694
39694
|
prsCommand.command("comment <path> <line> <body>").description(
|
|
39695
39695
|
"Add a line comment to the pending review (body of - reads it from stdin)"
|
|
39696
|
-
).action(async (
|
|
39696
|
+
).action(async (path115, line, body) => {
|
|
39697
39697
|
await comment2(
|
|
39698
|
-
|
|
39698
|
+
path115,
|
|
39699
39699
|
Number.parseInt(line, 10),
|
|
39700
39700
|
await readBodyArgument(body)
|
|
39701
39701
|
);
|
|
@@ -39823,9 +39823,9 @@ function splitOnce(value, separator) {
|
|
|
39823
39823
|
if (index3 === -1) return null;
|
|
39824
39824
|
return [value.slice(0, index3), value.slice(index3 + separator.length)];
|
|
39825
39825
|
}
|
|
39826
|
-
function isFile2(
|
|
39826
|
+
function isFile2(path115) {
|
|
39827
39827
|
try {
|
|
39828
|
-
return statSync11(
|
|
39828
|
+
return statSync11(path115).isFile();
|
|
39829
39829
|
} catch {
|
|
39830
39830
|
return false;
|
|
39831
39831
|
}
|
|
@@ -39833,16 +39833,16 @@ function isFile2(path114) {
|
|
|
39833
39833
|
function parseScreenshotSpec(spec) {
|
|
39834
39834
|
const [label, rawPath] = splitOnce(spec, "=") ?? ["", spec];
|
|
39835
39835
|
const [group, caption] = splitOnce(label, "/") ?? ["", label];
|
|
39836
|
-
const
|
|
39837
|
-
const ext = extname5(
|
|
39838
|
-
if (!isFile2(
|
|
39839
|
-
throw new Error(`--screenshot '${spec}': file not found: ${
|
|
39836
|
+
const path115 = resolve27(rawPath.trim());
|
|
39837
|
+
const ext = extname5(path115).replace(/^\./, "").toLowerCase();
|
|
39838
|
+
if (!isFile2(path115))
|
|
39839
|
+
throw new Error(`--screenshot '${spec}': file not found: ${path115}`);
|
|
39840
39840
|
if (!ghAttachableExtensions.has(ext))
|
|
39841
39841
|
throw new Error(
|
|
39842
39842
|
`--screenshot '${spec}': gh cannot attach .${ext || "(none)"} files (supported: ${[...ghAttachableExtensions].join(", ")}).`
|
|
39843
39843
|
);
|
|
39844
|
-
const alt = caption.trim() || basename24(
|
|
39845
|
-
return group.trim() ? { path:
|
|
39844
|
+
const alt = caption.trim() || basename24(path115, extname5(path115));
|
|
39845
|
+
return group.trim() ? { path: path115, alt, group: group.trim() } : { path: path115, alt };
|
|
39846
39846
|
}
|
|
39847
39847
|
|
|
39848
39848
|
// src/commands/prs/parseScreenshotSpecs.ts
|
|
@@ -41017,11 +41017,11 @@ async function loadBody(target) {
|
|
|
41017
41017
|
if (target.kind === "file") return readDraftFile(target.path);
|
|
41018
41018
|
return fetchPrBody(target.number, target.repo);
|
|
41019
41019
|
}
|
|
41020
|
-
function readDraftFile(
|
|
41020
|
+
function readDraftFile(path115) {
|
|
41021
41021
|
try {
|
|
41022
|
-
return readFileSync61(
|
|
41022
|
+
return readFileSync61(path115, "utf8");
|
|
41023
41023
|
} catch {
|
|
41024
|
-
console.error(`Error: Could not read \`${
|
|
41024
|
+
console.error(`Error: Could not read \`${path115}\`.`);
|
|
41025
41025
|
console.error(
|
|
41026
41026
|
"Pass a pull request number, a GitHub pull request URL, - for stdin, or a path to a file."
|
|
41027
41027
|
);
|
|
@@ -41301,10 +41301,10 @@ function resolveOpSecret(reference) {
|
|
|
41301
41301
|
}
|
|
41302
41302
|
|
|
41303
41303
|
// src/commands/ravendb/ravenFetch.ts
|
|
41304
|
-
async function ravenFetch(connection,
|
|
41304
|
+
async function ravenFetch(connection, path115) {
|
|
41305
41305
|
const apiKey = resolveOpSecret(connection.apiKeyRef);
|
|
41306
41306
|
let accessToken = await getAccessToken(apiKey);
|
|
41307
|
-
const url = `${connection.url}${
|
|
41307
|
+
const url = `${connection.url}${path115}`;
|
|
41308
41308
|
const headers = {
|
|
41309
41309
|
Authorization: `Bearer ${accessToken}`,
|
|
41310
41310
|
"Content-Type": "application/json"
|
|
@@ -41394,16 +41394,16 @@ import chalk228 from "chalk";
|
|
|
41394
41394
|
// src/commands/ravendb/buildQueryPath.ts
|
|
41395
41395
|
function buildQueryPath(opts) {
|
|
41396
41396
|
const db = encodeURIComponent(opts.db);
|
|
41397
|
-
let
|
|
41397
|
+
let path115;
|
|
41398
41398
|
if (opts.collection) {
|
|
41399
|
-
|
|
41399
|
+
path115 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
|
|
41400
41400
|
} else {
|
|
41401
|
-
|
|
41401
|
+
path115 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
|
|
41402
41402
|
}
|
|
41403
41403
|
if (opts.query) {
|
|
41404
|
-
|
|
41404
|
+
path115 += `&query=${encodeURIComponent(opts.query)}`;
|
|
41405
41405
|
}
|
|
41406
|
-
return
|
|
41406
|
+
return path115;
|
|
41407
41407
|
}
|
|
41408
41408
|
|
|
41409
41409
|
// src/commands/ravendb/fetchAllPages.ts
|
|
@@ -41412,7 +41412,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
41412
41412
|
let start2 = 0;
|
|
41413
41413
|
while (true) {
|
|
41414
41414
|
const effectivePageSize = opts.limit !== void 0 ? Math.min(opts.pageSize, opts.limit - allResults.length) : opts.pageSize;
|
|
41415
|
-
const
|
|
41415
|
+
const path115 = buildQueryPath({
|
|
41416
41416
|
db: connection.database,
|
|
41417
41417
|
collection: opts.collection,
|
|
41418
41418
|
start: start2,
|
|
@@ -41420,7 +41420,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
41420
41420
|
sort: opts.sort,
|
|
41421
41421
|
query: opts.query
|
|
41422
41422
|
});
|
|
41423
|
-
const data = await ravenFetch(connection,
|
|
41423
|
+
const data = await ravenFetch(connection, path115);
|
|
41424
41424
|
const results = data.Results ?? [];
|
|
41425
41425
|
const totalResults = data.TotalResults ?? 0;
|
|
41426
41426
|
if (results.length === 0) break;
|
|
@@ -44461,8 +44461,8 @@ function displayLongPaths(longPaths, maxPathLength) {
|
|
|
44461
44461
|
Plan exceeds restructure.maxPathLength ${maxPathLength}: ${longPaths.length} repo-relative path(s) longer.`
|
|
44462
44462
|
)
|
|
44463
44463
|
);
|
|
44464
|
-
for (const { path:
|
|
44465
|
-
console.log(` ${
|
|
44464
|
+
for (const { path: path115, length } of longPaths)
|
|
44465
|
+
console.log(` ${path115} [${length}]`);
|
|
44466
44466
|
}
|
|
44467
44467
|
|
|
44468
44468
|
// src/commands/refactor/restructure/displayLayoutLimits.ts
|
|
@@ -45178,8 +45178,8 @@ function groupFilesByDirectory(files) {
|
|
|
45178
45178
|
}
|
|
45179
45179
|
|
|
45180
45180
|
// src/commands/review/highLevel/buildHighLevelTree.ts
|
|
45181
|
-
function basename26(
|
|
45182
|
-
return
|
|
45181
|
+
function basename26(path115) {
|
|
45182
|
+
return path115.slice(path115.lastIndexOf("/") + 1);
|
|
45183
45183
|
}
|
|
45184
45184
|
function sum(nodes, key) {
|
|
45185
45185
|
return nodes.reduce((total2, node) => total2 + node[key], 0);
|
|
@@ -45200,19 +45200,19 @@ function nodesOf(at2, prefix2) {
|
|
|
45200
45200
|
}
|
|
45201
45201
|
function collapsedDirNode(name2, at2, prefix2) {
|
|
45202
45202
|
let label = name2;
|
|
45203
|
-
let
|
|
45203
|
+
let path115 = prefix2 ? `${prefix2}/${name2}` : name2;
|
|
45204
45204
|
let node = at2;
|
|
45205
45205
|
while (node.files.length === 0 && node.dirs.size === 1) {
|
|
45206
45206
|
const [childName, child] = [...node.dirs][0];
|
|
45207
45207
|
label = `${label}/${childName}`;
|
|
45208
|
-
|
|
45208
|
+
path115 = `${path115}/${childName}`;
|
|
45209
45209
|
node = child;
|
|
45210
45210
|
}
|
|
45211
|
-
const children = nodesOf(node,
|
|
45211
|
+
const children = nodesOf(node, path115);
|
|
45212
45212
|
return {
|
|
45213
45213
|
kind: "dir",
|
|
45214
45214
|
name: label,
|
|
45215
|
-
path:
|
|
45215
|
+
path: path115,
|
|
45216
45216
|
additions: sum(children, "additions"),
|
|
45217
45217
|
deletions: sum(children, "deletions"),
|
|
45218
45218
|
children
|
|
@@ -45517,8 +45517,8 @@ function toStatus(status2) {
|
|
|
45517
45517
|
if (status2 === "removed") return "removed";
|
|
45518
45518
|
return "modified";
|
|
45519
45519
|
}
|
|
45520
|
-
function diffUrl(repo, prNumber,
|
|
45521
|
-
const anchor = createHash4("sha256").update(
|
|
45520
|
+
function diffUrl(repo, prNumber, path115) {
|
|
45521
|
+
const anchor = createHash4("sha256").update(path115).digest("hex");
|
|
45522
45522
|
return `https://github.com/${repo}/pull/${prNumber}/files#diff-${anchor}`;
|
|
45523
45523
|
}
|
|
45524
45524
|
function fetchHighLevelFiles(prNumber, repo) {
|
|
@@ -45708,10 +45708,10 @@ function listHighLevelHunks(files) {
|
|
|
45708
45708
|
|
|
45709
45709
|
// src/commands/review/highLevel/readJsonFile.ts
|
|
45710
45710
|
import { existsSync as existsSync77, readFileSync as readFileSync64 } from "fs";
|
|
45711
|
-
function readJsonFile(
|
|
45712
|
-
if (!existsSync77(
|
|
45711
|
+
function readJsonFile(path115) {
|
|
45712
|
+
if (!existsSync77(path115)) return void 0;
|
|
45713
45713
|
try {
|
|
45714
|
-
return JSON.parse(readFileSync64(
|
|
45714
|
+
return JSON.parse(readFileSync64(path115, "utf8"));
|
|
45715
45715
|
} catch {
|
|
45716
45716
|
return void 0;
|
|
45717
45717
|
}
|
|
@@ -45792,11 +45792,11 @@ function resolveHighLevelSlices(raw, hunks) {
|
|
|
45792
45792
|
// src/commands/review/highLevel/writeJsonFile.ts
|
|
45793
45793
|
import { mkdirSync as mkdirSync34, writeFileSync as writeFileSync49 } from "fs";
|
|
45794
45794
|
import { dirname as dirname45 } from "path";
|
|
45795
|
-
function writeJsonFile(
|
|
45796
|
-
mkdirSync34(dirname45(
|
|
45797
|
-
writeFileSync49(
|
|
45795
|
+
function writeJsonFile(path115, data) {
|
|
45796
|
+
mkdirSync34(dirname45(path115), { recursive: true });
|
|
45797
|
+
writeFileSync49(path115, `${JSON.stringify(data, null, 2)}
|
|
45798
45798
|
`);
|
|
45799
|
-
return
|
|
45799
|
+
return path115;
|
|
45800
45800
|
}
|
|
45801
45801
|
|
|
45802
45802
|
// src/commands/review/highLevel/gatherHighLevelSlices.ts
|
|
@@ -45809,23 +45809,23 @@ function readSlicesFile(file) {
|
|
|
45809
45809
|
);
|
|
45810
45810
|
}
|
|
45811
45811
|
}
|
|
45812
|
-
function sliceFromFile(file, files,
|
|
45812
|
+
function sliceFromFile(file, files, path115) {
|
|
45813
45813
|
const { warnings, ...set } = resolveHighLevelSlices(
|
|
45814
45814
|
readSlicesFile(file),
|
|
45815
45815
|
listHighLevelHunks(files)
|
|
45816
45816
|
);
|
|
45817
45817
|
for (const warning of warnings) console.warn(`Warning: ${warning}`);
|
|
45818
|
-
writeJsonFile(
|
|
45818
|
+
writeJsonFile(path115, set);
|
|
45819
45819
|
return set;
|
|
45820
45820
|
}
|
|
45821
|
-
function readSavedSlices(
|
|
45822
|
-
const saved = readJsonFile(
|
|
45821
|
+
function readSavedSlices(path115) {
|
|
45822
|
+
const saved = readJsonFile(path115);
|
|
45823
45823
|
return Array.isArray(saved) ? { slices: saved } : saved;
|
|
45824
45824
|
}
|
|
45825
45825
|
function gatherHighLevelSlices(head, files, slicing) {
|
|
45826
|
-
const
|
|
45827
|
-
if (slicing.slicesFile) return sliceFromFile(slicing.slicesFile, files,
|
|
45828
|
-
const saved = slicing.force ? void 0 : readSavedSlices(
|
|
45826
|
+
const path115 = highLevelSlicesPath(head.repo, head.headRef, head.headSha);
|
|
45827
|
+
if (slicing.slicesFile) return sliceFromFile(slicing.slicesFile, files, path115);
|
|
45828
|
+
const saved = slicing.force ? void 0 : readSavedSlices(path115);
|
|
45829
45829
|
if (saved) return saved;
|
|
45830
45830
|
console.log(formatSlicingRequest(listHighLevelHunks(files)));
|
|
45831
45831
|
process.exit(2);
|
|
@@ -46007,13 +46007,13 @@ function visit(node, context) {
|
|
|
46007
46007
|
}
|
|
46008
46008
|
];
|
|
46009
46009
|
}
|
|
46010
|
-
function extractTestHierarchy(
|
|
46010
|
+
function extractTestHierarchy(path115, text19, changed) {
|
|
46011
46011
|
const project = new Project5({
|
|
46012
46012
|
useInMemoryFileSystem: true,
|
|
46013
46013
|
compilerOptions: { allowJs: true }
|
|
46014
46014
|
});
|
|
46015
|
-
const source = project.createSourceFile(`/${
|
|
46016
|
-
return collect7(source, { path:
|
|
46015
|
+
const source = project.createSourceFile(`/${path115}`, text19);
|
|
46016
|
+
return collect7(source, { path: path115, ...changed ? { changed } : {} });
|
|
46017
46017
|
}
|
|
46018
46018
|
|
|
46019
46019
|
// src/commands/review/highLevel/patchAddedLines.ts
|
|
@@ -46035,8 +46035,8 @@ function testFile(file, readSource4) {
|
|
|
46035
46035
|
const changed = file.patch === void 0 ? void 0 : patchAddedLines(file.patch);
|
|
46036
46036
|
const tests = extractTestHierarchy(file.path, readSource4(file.path), changed);
|
|
46037
46037
|
if (tests.length === 0) return [];
|
|
46038
|
-
const { path:
|
|
46039
|
-
return [{ path:
|
|
46038
|
+
const { path: path115, status: status2, additions, deletions, diffUrl: diffUrl2 } = file;
|
|
46039
|
+
return [{ path: path115, status: status2, additions, deletions, diffUrl: diffUrl2, tests }];
|
|
46040
46040
|
}
|
|
46041
46041
|
function collectHighLevelTests(files, testPaths, readSource4) {
|
|
46042
46042
|
return files.filter(
|
|
@@ -46046,8 +46046,8 @@ function collectHighLevelTests(files, testPaths, readSource4) {
|
|
|
46046
46046
|
|
|
46047
46047
|
// src/commands/review/highLevel/fetchFileAtSha.ts
|
|
46048
46048
|
import { execFileSync as execFileSync29 } from "child_process";
|
|
46049
|
-
function fetchFileAtSha(repo, sha,
|
|
46050
|
-
const encodedPath =
|
|
46049
|
+
function fetchFileAtSha(repo, sha, path115) {
|
|
46050
|
+
const encodedPath = path115.split("/").map(encodeURIComponent).join("/");
|
|
46051
46051
|
try {
|
|
46052
46052
|
return execFileSync29(
|
|
46053
46053
|
"gh",
|
|
@@ -46065,7 +46065,7 @@ function fetchFileAtSha(repo, sha, path114) {
|
|
|
46065
46065
|
);
|
|
46066
46066
|
} catch (error) {
|
|
46067
46067
|
throw new Error(
|
|
46068
|
-
`Could not read ${
|
|
46068
|
+
`Could not read ${path115} at PR head ${sha.slice(0, 7)}: ${ghFailure(error)}`
|
|
46069
46069
|
);
|
|
46070
46070
|
}
|
|
46071
46071
|
}
|
|
@@ -46076,7 +46076,7 @@ function gatherHighLevelTests(files, testPaths, repo, headSha) {
|
|
|
46076
46076
|
collectHighLevelTests(
|
|
46077
46077
|
files,
|
|
46078
46078
|
testPaths,
|
|
46079
|
-
(
|
|
46079
|
+
(path115) => fetchFileAtSha(repo, headSha, path115)
|
|
46080
46080
|
)
|
|
46081
46081
|
);
|
|
46082
46082
|
}
|
|
@@ -46114,8 +46114,8 @@ import { minimatch as minimatch8 } from "minimatch";
|
|
|
46114
46114
|
function selectCriticalDiffs(files, criticalPaths) {
|
|
46115
46115
|
if (criticalPaths.length === 0) return [];
|
|
46116
46116
|
return files.filter((file) => criticalPaths.some((glob) => minimatch8(file.path, glob))).map(
|
|
46117
|
-
({ path:
|
|
46118
|
-
path:
|
|
46117
|
+
({ path: path115, status: status2, additions, deletions, diffUrl: diffUrl2, patch: patch2, truncated }) => ({
|
|
46118
|
+
path: path115,
|
|
46119
46119
|
status: status2,
|
|
46120
46120
|
additions,
|
|
46121
46121
|
deletions,
|
|
@@ -46320,14 +46320,14 @@ function saveHighLevelReview(record3) {
|
|
|
46320
46320
|
|
|
46321
46321
|
// src/commands/review/highLevel/formatReviewComment.ts
|
|
46322
46322
|
function formatReviewComment({
|
|
46323
|
-
path:
|
|
46323
|
+
path: path115,
|
|
46324
46324
|
startLine,
|
|
46325
46325
|
endLine,
|
|
46326
46326
|
quote,
|
|
46327
46327
|
note
|
|
46328
46328
|
}) {
|
|
46329
46329
|
const lines = startLine === endLine ? `${startLine}` : `${startLine}-${endLine}`;
|
|
46330
|
-
return `- \`${
|
|
46330
|
+
return `- \`${path115}:${lines}\` ${quote}: ${note.replace(/\n/g, "\n ")}`;
|
|
46331
46331
|
}
|
|
46332
46332
|
|
|
46333
46333
|
// src/commands/review/highLevel/formatHighLevelReviewBody.ts
|
|
@@ -47676,8 +47676,8 @@ function fetchExistingComments() {
|
|
|
47676
47676
|
// src/commands/review/prepareReviewDir.ts
|
|
47677
47677
|
import { existsSync as existsSync79, mkdirSync as mkdirSync36, unlinkSync as unlinkSync19, writeFileSync as writeFileSync50 } from "fs";
|
|
47678
47678
|
function clearReviewFiles(paths) {
|
|
47679
|
-
for (const
|
|
47680
|
-
if (existsSync79(
|
|
47679
|
+
for (const path115 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
47680
|
+
if (existsSync79(path115)) unlinkSync19(path115);
|
|
47681
47681
|
}
|
|
47682
47682
|
}
|
|
47683
47683
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -48935,8 +48935,8 @@ import chalk282 from "chalk";
|
|
|
48935
48935
|
|
|
48936
48936
|
// src/commands/seq/fetchSeq.ts
|
|
48937
48937
|
import chalk279 from "chalk";
|
|
48938
|
-
async function fetchSeq(conn,
|
|
48939
|
-
const url = `${conn.url}${
|
|
48938
|
+
async function fetchSeq(conn, path115, params) {
|
|
48939
|
+
const url = `${conn.url}${path115}?${params}`;
|
|
48940
48940
|
const response = await fetch(url, {
|
|
48941
48941
|
headers: {
|
|
48942
48942
|
Accept: "application/json",
|
|
@@ -49246,17 +49246,17 @@ import { homedir as homedir28 } from "os";
|
|
|
49246
49246
|
// src/commands/show/findShownSessionFiles.ts
|
|
49247
49247
|
var NOT_AFTER = String.raw`(?![\w\-/]|\.\w)`;
|
|
49248
49248
|
var NOT_BEFORE_RELATIVE = String.raw`(?<=^|[^\w.\-/~]|(?:^|[^\w.\-/~])\./)`;
|
|
49249
|
-
function normalise(
|
|
49250
|
-
return
|
|
49249
|
+
function normalise(path115) {
|
|
49250
|
+
return path115.replaceAll("\\", "/").replace(/\/+$/, "");
|
|
49251
49251
|
}
|
|
49252
49252
|
function escapeRegExp2(text19) {
|
|
49253
49253
|
return text19.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
|
|
49254
49254
|
}
|
|
49255
|
-
function within(
|
|
49256
|
-
return dir &&
|
|
49255
|
+
function within(path115, dir) {
|
|
49256
|
+
return dir && path115.startsWith(`${dir}/`) ? path115.slice(dir.length + 1) : void 0;
|
|
49257
49257
|
}
|
|
49258
|
-
function referencePatterns(
|
|
49259
|
-
const file = normalise(
|
|
49258
|
+
function referencePatterns(path115, { home, cwd }) {
|
|
49259
|
+
const file = normalise(path115);
|
|
49260
49260
|
const forms = [escapeRegExp2(file)];
|
|
49261
49261
|
const drive = /^\/mnt\/([a-z])\/(.+)$/i.exec(file);
|
|
49262
49262
|
if (drive)
|
|
@@ -49276,7 +49276,7 @@ function referencePatterns(path114, { home, cwd }) {
|
|
|
49276
49276
|
function findShownSessionFiles(body, writtenPaths2, locations) {
|
|
49277
49277
|
const text19 = body.replaceAll("\\", "/");
|
|
49278
49278
|
return writtenPaths2.filter(
|
|
49279
|
-
(
|
|
49279
|
+
(path115) => referencePatterns(path115, locations).some((pattern2) => pattern2.test(text19))
|
|
49280
49280
|
);
|
|
49281
49281
|
}
|
|
49282
49282
|
|
|
@@ -49308,7 +49308,7 @@ async function refuseSessionFiles(body) {
|
|
|
49308
49308
|
console.error(
|
|
49309
49309
|
[
|
|
49310
49310
|
"Error: refusing to show files this session created or edited; the user already sees them in the session's diff:",
|
|
49311
|
-
...shown.map((
|
|
49311
|
+
...shown.map((path115) => ` ${path115}`),
|
|
49312
49312
|
"Remove them (and any label or folder entry that exists only for them) and re-run, or skip the show if nothing is left."
|
|
49313
49313
|
].join("\n")
|
|
49314
49314
|
);
|
|
@@ -49689,7 +49689,7 @@ function registerSql(program) {
|
|
|
49689
49689
|
|
|
49690
49690
|
// src/commands/sync.ts
|
|
49691
49691
|
import * as os6 from "os";
|
|
49692
|
-
import * as
|
|
49692
|
+
import * as path111 from "path";
|
|
49693
49693
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
49694
49694
|
|
|
49695
49695
|
// src/commands/sync/pruneCommands.ts
|
|
@@ -49896,7 +49896,7 @@ function reportRetiredAgentsFiles() {
|
|
|
49896
49896
|
}
|
|
49897
49897
|
|
|
49898
49898
|
// src/commands/sync/syncCodex.ts
|
|
49899
|
-
import * as
|
|
49899
|
+
import * as path106 from "path";
|
|
49900
49900
|
|
|
49901
49901
|
// src/commands/sync/installDesignResources.ts
|
|
49902
49902
|
import * as fs50 from "fs";
|
|
@@ -49967,15 +49967,273 @@ function installHarnessCommands(claudeDir, harness, transform) {
|
|
|
49967
49967
|
}
|
|
49968
49968
|
|
|
49969
49969
|
// src/commands/sync/syncCodexHooks.ts
|
|
49970
|
-
import * as
|
|
49970
|
+
import * as fs53 from "fs";
|
|
49971
|
+
import * as path105 from "path";
|
|
49972
|
+
|
|
49973
|
+
// src/commands/sync/assistCodexHookKeys.ts
|
|
49974
|
+
var GROUP_HEADER = /^\s*\[\[\s*hooks\.([A-Za-z]+)\s*\]\]\s*(#.*)?$/;
|
|
49975
|
+
var HANDLER_HEADER = /^\s*\[\[\s*hooks\.([A-Za-z]+)\.hooks\s*\]\]\s*(#.*)?$/;
|
|
49976
|
+
var COMMAND = /^\s*command\s*=\s*("(?:[^"\\]|\\.)*")\s*(#.*)?$/;
|
|
49977
|
+
function snakeCase(event) {
|
|
49978
|
+
return event.replace(/(?<!^)([A-Z])/g, "_$1").toLowerCase();
|
|
49979
|
+
}
|
|
49980
|
+
function countGroups(toml) {
|
|
49981
|
+
const counts2 = /* @__PURE__ */ new Map();
|
|
49982
|
+
for (const line of toml.split("\n")) {
|
|
49983
|
+
const event = GROUP_HEADER.exec(line)?.[1];
|
|
49984
|
+
if (event) counts2.set(event, (counts2.get(event) ?? 0) + 1);
|
|
49985
|
+
}
|
|
49986
|
+
return counts2;
|
|
49987
|
+
}
|
|
49988
|
+
function assistCodexHookKeys(before, body) {
|
|
49989
|
+
const groups = countGroups(before);
|
|
49990
|
+
const keys = /* @__PURE__ */ new Map();
|
|
49991
|
+
let suffix;
|
|
49992
|
+
let group = -1;
|
|
49993
|
+
let handler = -1;
|
|
49994
|
+
for (const line of body.split("\n")) {
|
|
49995
|
+
const groupEvent = GROUP_HEADER.exec(line)?.[1];
|
|
49996
|
+
if (groupEvent) {
|
|
49997
|
+
group = groups.get(groupEvent) ?? 0;
|
|
49998
|
+
groups.set(groupEvent, group + 1);
|
|
49999
|
+
handler = -1;
|
|
50000
|
+
suffix = void 0;
|
|
50001
|
+
continue;
|
|
50002
|
+
}
|
|
50003
|
+
const handlerEvent = HANDLER_HEADER.exec(line)?.[1];
|
|
50004
|
+
if (handlerEvent) {
|
|
50005
|
+
handler++;
|
|
50006
|
+
suffix = `${snakeCase(handlerEvent)}:${group}:${handler}`;
|
|
50007
|
+
continue;
|
|
50008
|
+
}
|
|
50009
|
+
const command = COMMAND.exec(line)?.[1];
|
|
50010
|
+
if (command && suffix) keys.set(suffix, JSON.parse(command));
|
|
50011
|
+
}
|
|
50012
|
+
return keys;
|
|
50013
|
+
}
|
|
50014
|
+
|
|
50015
|
+
// src/commands/sync/trustAssistCodexHooks.ts
|
|
49971
50016
|
import * as path104 from "path";
|
|
49972
|
-
|
|
50017
|
+
|
|
50018
|
+
// src/commands/sync/CodexRpcError.ts
|
|
50019
|
+
var CodexRpcError = class extends Error {
|
|
50020
|
+
constructor(method, code, message4) {
|
|
50021
|
+
super(`${method}: ${message4}`);
|
|
50022
|
+
this.method = method;
|
|
50023
|
+
this.code = code;
|
|
50024
|
+
this.name = "CodexRpcError";
|
|
50025
|
+
}
|
|
50026
|
+
method;
|
|
50027
|
+
code;
|
|
50028
|
+
};
|
|
50029
|
+
|
|
50030
|
+
// src/commands/sync/unsupportedCodexTrust.ts
|
|
50031
|
+
var METHOD_NOT_FOUND = -32601;
|
|
50032
|
+
var FALLBACK = "Codex will ask you to review Assist's hooks on its next launch; choose Review hooks and trust only the `assist codex-hook` entries.";
|
|
50033
|
+
function unsupportedCodexTrust(error) {
|
|
50034
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
50035
|
+
const upgrade = error instanceof CodexRpcError && (error.code === METHOD_NOT_FOUND || error.method === "initialize") ? " This Codex CLI cannot grant selective hook trust; upgrade it with `codex update` and rerun `assist sync`." : "";
|
|
50036
|
+
return new Error(`${detail}.${upgrade} ${FALLBACK}`);
|
|
50037
|
+
}
|
|
50038
|
+
function describeMissingCodexHooks(data) {
|
|
50039
|
+
const problems = data.flatMap((entry) => [
|
|
50040
|
+
...entry.errors.map((e) => `${e.path}: ${e.message}`),
|
|
50041
|
+
...entry.warnings
|
|
50042
|
+
]);
|
|
50043
|
+
return `${problems.length ? ` Codex reported: ${problems.join("; ")}.` : ""} ${FALLBACK}`;
|
|
50044
|
+
}
|
|
50045
|
+
|
|
50046
|
+
// src/commands/sync/listCodexHooks.ts
|
|
50047
|
+
async function listCodexHooks(server, cwd) {
|
|
50048
|
+
try {
|
|
50049
|
+
return (await server.call("hooks/list", { cwds: [cwd] })).data;
|
|
50050
|
+
} catch (error) {
|
|
50051
|
+
throw unsupportedCodexTrust(error);
|
|
50052
|
+
}
|
|
50053
|
+
}
|
|
50054
|
+
|
|
50055
|
+
// src/commands/sync/openCodexAppServer.ts
|
|
50056
|
+
import { spawn as spawn11 } from "child_process";
|
|
50057
|
+
import { createInterface as createInterface6 } from "readline";
|
|
50058
|
+
|
|
50059
|
+
// src/commands/sync/createCodexRpcClient.ts
|
|
50060
|
+
function createCodexRpcClient(child, pending, timer) {
|
|
50061
|
+
let nextId = 0;
|
|
50062
|
+
return {
|
|
50063
|
+
call(method, params) {
|
|
50064
|
+
return new Promise((resolve35, reject) => {
|
|
50065
|
+
const id = ++nextId;
|
|
50066
|
+
pending.set(id, {
|
|
50067
|
+
method,
|
|
50068
|
+
resolve: resolve35,
|
|
50069
|
+
reject
|
|
50070
|
+
});
|
|
50071
|
+
child.stdin.write(`${JSON.stringify({ id, method, params })}
|
|
50072
|
+
`);
|
|
50073
|
+
});
|
|
50074
|
+
},
|
|
50075
|
+
close() {
|
|
50076
|
+
clearTimeout(timer);
|
|
50077
|
+
child.removeAllListeners("exit");
|
|
50078
|
+
child.stdin.end();
|
|
50079
|
+
child.kill();
|
|
50080
|
+
}
|
|
50081
|
+
};
|
|
50082
|
+
}
|
|
50083
|
+
|
|
50084
|
+
// src/commands/sync/routeCodexRpcLine.ts
|
|
50085
|
+
function routeCodexRpcLine(line, pending) {
|
|
50086
|
+
let message4;
|
|
50087
|
+
try {
|
|
50088
|
+
message4 = JSON.parse(line);
|
|
50089
|
+
} catch {
|
|
50090
|
+
return;
|
|
50091
|
+
}
|
|
50092
|
+
if (typeof message4.id !== "number") return;
|
|
50093
|
+
const entry = pending.get(message4.id);
|
|
50094
|
+
if (!entry) return;
|
|
50095
|
+
pending.delete(message4.id);
|
|
50096
|
+
if (message4.error)
|
|
50097
|
+
entry.reject(
|
|
50098
|
+
new CodexRpcError(
|
|
50099
|
+
entry.method,
|
|
50100
|
+
message4.error.code,
|
|
50101
|
+
message4.error.message
|
|
50102
|
+
)
|
|
50103
|
+
);
|
|
50104
|
+
else entry.resolve(message4.result);
|
|
50105
|
+
}
|
|
50106
|
+
|
|
50107
|
+
// src/commands/sync/watchCodexAppServer.ts
|
|
50108
|
+
function watchCodexAppServer(child, fail15) {
|
|
50109
|
+
let stderr = "";
|
|
50110
|
+
child.stderr.on("data", (chunk2) => {
|
|
50111
|
+
stderr += chunk2;
|
|
50112
|
+
});
|
|
50113
|
+
child.on("error", fail15);
|
|
50114
|
+
child.stdin.on("error", fail15);
|
|
50115
|
+
child.on(
|
|
50116
|
+
"exit",
|
|
50117
|
+
(code) => fail15(
|
|
50118
|
+
new Error(
|
|
50119
|
+
`codex app-server exited (${code})${stderr.trim() ? `: ${stderr.trim()}` : ""}`
|
|
50120
|
+
)
|
|
50121
|
+
)
|
|
50122
|
+
);
|
|
50123
|
+
}
|
|
50124
|
+
|
|
50125
|
+
// src/commands/sync/openCodexAppServer.ts
|
|
50126
|
+
var TIMEOUT_MS2 = 2e4;
|
|
50127
|
+
async function openCodexAppServer(homeDir) {
|
|
50128
|
+
const child = spawn11(harnesses.codex.command, ["app-server"], {
|
|
50129
|
+
env: { ...process.env, CODEX_HOME: homeDir },
|
|
50130
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
50131
|
+
});
|
|
50132
|
+
const pending = /* @__PURE__ */ new Map();
|
|
50133
|
+
const failAll = (error) => {
|
|
50134
|
+
for (const entry of pending.values()) entry.reject(error);
|
|
50135
|
+
pending.clear();
|
|
50136
|
+
};
|
|
50137
|
+
watchCodexAppServer(child, failAll);
|
|
50138
|
+
createInterface6({ input: child.stdout }).on(
|
|
50139
|
+
"line",
|
|
50140
|
+
(line) => routeCodexRpcLine(line, pending)
|
|
50141
|
+
);
|
|
50142
|
+
const timer = setTimeout(
|
|
50143
|
+
() => failAll(new Error("codex app-server did not respond in time")),
|
|
50144
|
+
TIMEOUT_MS2
|
|
50145
|
+
);
|
|
50146
|
+
const server = createCodexRpcClient(child, pending, timer);
|
|
50147
|
+
try {
|
|
50148
|
+
await server.call("initialize", {
|
|
50149
|
+
clientInfo: { name: "assist", version: "0" }
|
|
50150
|
+
});
|
|
50151
|
+
} catch (error) {
|
|
50152
|
+
server.close();
|
|
50153
|
+
throw error;
|
|
50154
|
+
}
|
|
50155
|
+
child.stdin.write(`${JSON.stringify({ method: "initialized" })}
|
|
50156
|
+
`);
|
|
50157
|
+
return server;
|
|
50158
|
+
}
|
|
50159
|
+
|
|
50160
|
+
// src/commands/sync/selectAssistCodexHooks.ts
|
|
50161
|
+
import * as fs52 from "fs";
|
|
50162
|
+
function samePath(a, b) {
|
|
50163
|
+
if (a === b) return true;
|
|
50164
|
+
try {
|
|
50165
|
+
return fs52.realpathSync(a) === fs52.realpathSync(b);
|
|
50166
|
+
} catch {
|
|
50167
|
+
return false;
|
|
50168
|
+
}
|
|
50169
|
+
}
|
|
50170
|
+
function selectAssistCodexHooks(hooks, configPath, expected) {
|
|
50171
|
+
return hooks.filter((hook) => {
|
|
50172
|
+
if (hook.source !== "user" || hook.pluginId || hook.isManaged) return false;
|
|
50173
|
+
if (hook.handlerType !== "command") return false;
|
|
50174
|
+
if (!samePath(hook.sourcePath, configPath)) return false;
|
|
50175
|
+
const prefix2 = `${hook.sourcePath}:`;
|
|
50176
|
+
if (!hook.key.startsWith(prefix2)) return false;
|
|
50177
|
+
const command = expected.get(hook.key.slice(prefix2.length));
|
|
50178
|
+
return command !== void 0 && hook.command === command;
|
|
50179
|
+
});
|
|
50180
|
+
}
|
|
50181
|
+
|
|
50182
|
+
// src/commands/sync/writeCodexHookTrust.ts
|
|
50183
|
+
async function writeCodexHookTrust(server, configPath, hooks) {
|
|
50184
|
+
const value = Object.fromEntries(
|
|
50185
|
+
hooks.map((hook) => [hook.key, { trusted_hash: hook.currentHash }])
|
|
50186
|
+
);
|
|
50187
|
+
try {
|
|
50188
|
+
await server.call("config/batchWrite", {
|
|
50189
|
+
filePath: configPath,
|
|
50190
|
+
edits: [{ keyPath: "hooks.state", mergeStrategy: "upsert", value }]
|
|
50191
|
+
});
|
|
50192
|
+
} catch (error) {
|
|
50193
|
+
throw unsupportedCodexTrust(error);
|
|
50194
|
+
}
|
|
50195
|
+
}
|
|
50196
|
+
|
|
50197
|
+
// src/commands/sync/trustAssistCodexHooks.ts
|
|
50198
|
+
async function trustAssistCodexHooks(configPath, expected) {
|
|
50199
|
+
const homeDir = path104.dirname(configPath);
|
|
50200
|
+
let server;
|
|
50201
|
+
try {
|
|
50202
|
+
server = await openCodexAppServer(homeDir);
|
|
50203
|
+
} catch (error) {
|
|
50204
|
+
throw unsupportedCodexTrust(error);
|
|
50205
|
+
}
|
|
50206
|
+
try {
|
|
50207
|
+
const data = await listCodexHooks(server, homeDir);
|
|
50208
|
+
const owned = selectAssistCodexHooks(
|
|
50209
|
+
data.flatMap((entry) => entry.hooks),
|
|
50210
|
+
configPath,
|
|
50211
|
+
expected
|
|
50212
|
+
);
|
|
50213
|
+
if (owned.length < expected.size)
|
|
50214
|
+
throw new Error(
|
|
50215
|
+
`Codex reported ${owned.length} of Assist's ${expected.size} hooks in ${configPath}.${describeMissingCodexHooks(data)}`
|
|
50216
|
+
);
|
|
50217
|
+
const pending = owned.filter(
|
|
50218
|
+
(hook) => hook.trustStatus === "untrusted" || hook.trustStatus === "modified"
|
|
50219
|
+
);
|
|
50220
|
+
if (pending.length) await writeCodexHookTrust(server, configPath, pending);
|
|
50221
|
+
return pending.length;
|
|
50222
|
+
} finally {
|
|
50223
|
+
server.close();
|
|
50224
|
+
}
|
|
50225
|
+
}
|
|
50226
|
+
|
|
50227
|
+
// src/commands/sync/upsertManagedBlock.ts
|
|
50228
|
+
var MANAGED_BLOCK_BEGIN = "# >>> assist codex hooks (managed) \u2014 do not edit >>>";
|
|
49973
50229
|
var END = "# <<< assist codex hooks (managed) <<<";
|
|
50230
|
+
var TABLE_HEADER = /^\s*\[/;
|
|
50231
|
+
var MANAGED_HEADER = /^\s*\[\[\s*hooks\.[A-Za-z]+(\.hooks)?\s*\]\]\s*$/;
|
|
49974
50232
|
function upsertManagedBlock(existing, body) {
|
|
49975
|
-
const block = `${
|
|
50233
|
+
const block = `${MANAGED_BLOCK_BEGIN}
|
|
49976
50234
|
${body.trim()}
|
|
49977
50235
|
${END}`;
|
|
49978
|
-
const begin = existing.indexOf(
|
|
50236
|
+
const begin = existing.indexOf(MANAGED_BLOCK_BEGIN);
|
|
49979
50237
|
if (begin === -1) {
|
|
49980
50238
|
const base = existing.replace(/\s*$/, "");
|
|
49981
50239
|
return base ? `${base}
|
|
@@ -49985,9 +50243,13 @@ ${block}
|
|
|
49985
50243
|
`;
|
|
49986
50244
|
}
|
|
49987
50245
|
const endMarker = existing.indexOf(END, begin);
|
|
50246
|
+
const innerEnd = endMarker === -1 ? existing.length : endMarker;
|
|
49988
50247
|
const after = endMarker === -1 ? existing.length : endMarker + END.length;
|
|
50248
|
+
const foreign = splitForeignTables(
|
|
50249
|
+
existing.slice(begin + MANAGED_BLOCK_BEGIN.length, innerEnd)
|
|
50250
|
+
);
|
|
49989
50251
|
const before = existing.slice(0, begin).replace(/\s*$/, "");
|
|
49990
|
-
const rest = existing.slice(after).
|
|
50252
|
+
const rest = [foreign, existing.slice(after).trim()].filter(Boolean).join("\n\n");
|
|
49991
50253
|
const head = before ? `${before}
|
|
49992
50254
|
|
|
49993
50255
|
${block}` : block;
|
|
@@ -49997,19 +50259,43 @@ ${rest}
|
|
|
49997
50259
|
` : `${head}
|
|
49998
50260
|
`;
|
|
49999
50261
|
}
|
|
50000
|
-
function
|
|
50001
|
-
const
|
|
50002
|
-
const
|
|
50003
|
-
|
|
50004
|
-
|
|
50005
|
-
|
|
50262
|
+
function splitForeignTables(inner) {
|
|
50263
|
+
const lines = inner.split("\n");
|
|
50264
|
+
const start2 = lines.findIndex(
|
|
50265
|
+
(line) => TABLE_HEADER.test(line) && !MANAGED_HEADER.test(line)
|
|
50266
|
+
);
|
|
50267
|
+
return start2 === -1 ? "" : lines.slice(start2).join("\n").trim();
|
|
50268
|
+
}
|
|
50269
|
+
|
|
50270
|
+
// src/commands/sync/syncCodexHooks.ts
|
|
50271
|
+
async function syncCodexHooks(sourcePath) {
|
|
50272
|
+
const body = fs53.readFileSync(sourcePath, "utf8");
|
|
50273
|
+
const configPath = path105.join(harnesses.codex.homeDir, "config.toml");
|
|
50274
|
+
const existing = fs53.existsSync(configPath) ? fs53.readFileSync(configPath, "utf8") : "";
|
|
50275
|
+
const next3 = upsertManagedBlock(existing, body);
|
|
50276
|
+
fs53.mkdirSync(path105.dirname(configPath), { recursive: true });
|
|
50277
|
+
fs53.writeFileSync(configPath, next3);
|
|
50006
50278
|
console.log(
|
|
50007
50279
|
"Registered assist codex-hook in ~/.codex/config.toml (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PermissionRequest, Stop)"
|
|
50008
50280
|
);
|
|
50281
|
+
const expected = assistCodexHookKeys(
|
|
50282
|
+
next3.slice(0, next3.indexOf(MANAGED_BLOCK_BEGIN)),
|
|
50283
|
+
body
|
|
50284
|
+
);
|
|
50285
|
+
try {
|
|
50286
|
+
const trusted = await trustAssistCodexHooks(configPath, expected);
|
|
50287
|
+
console.log(
|
|
50288
|
+
trusted ? `Trusted ${trusted} assist codex-hook definition(s) in Codex` : "Assist's codex-hook definitions are already trusted in Codex"
|
|
50289
|
+
);
|
|
50290
|
+
} catch (error) {
|
|
50291
|
+
console.error(
|
|
50292
|
+
`Could not trust Assist's Codex hooks: ${error instanceof Error ? error.message : String(error)}`
|
|
50293
|
+
);
|
|
50294
|
+
}
|
|
50009
50295
|
}
|
|
50010
50296
|
|
|
50011
50297
|
// src/commands/sync/syncCodex.ts
|
|
50012
|
-
function syncCodex(claudeDir, options2) {
|
|
50298
|
+
async function syncCodex(claudeDir, options2) {
|
|
50013
50299
|
if (!isHarnessAvailable("codex")) return;
|
|
50014
50300
|
const { total: total2, names } = installHarnessCommands(
|
|
50015
50301
|
claudeDir,
|
|
@@ -50017,7 +50303,7 @@ function syncCodex(claudeDir, options2) {
|
|
|
50017
50303
|
commandToSkill
|
|
50018
50304
|
);
|
|
50019
50305
|
const designSkills = installDesignResources(claudeDir, harnesses.codex);
|
|
50020
|
-
syncCodexHooks(
|
|
50306
|
+
await syncCodexHooks(path106.join(claudeDir, "..", "codex", "config.toml"));
|
|
50021
50307
|
console.log(`Synced ${total2} skill(s) to ~/.codex/skills`);
|
|
50022
50308
|
console.log(
|
|
50023
50309
|
`Synced the design system prompt and ${designSkills.length} design skill(s) for Codex`
|
|
@@ -50027,7 +50313,7 @@ function syncCodex(claudeDir, options2) {
|
|
|
50027
50313
|
reportPrune(
|
|
50028
50314
|
"~/.codex/skills",
|
|
50029
50315
|
pruneSkills(
|
|
50030
|
-
|
|
50316
|
+
path106.join(harnesses.codex.homeDir, "skills"),
|
|
50031
50317
|
[...names, ...designSkills],
|
|
50032
50318
|
{ force }
|
|
50033
50319
|
),
|
|
@@ -50036,27 +50322,27 @@ function syncCodex(claudeDir, options2) {
|
|
|
50036
50322
|
}
|
|
50037
50323
|
|
|
50038
50324
|
// src/commands/sync/syncDesign.ts
|
|
50039
|
-
import * as
|
|
50040
|
-
import * as
|
|
50325
|
+
import * as fs54 from "fs";
|
|
50326
|
+
import * as path107 from "path";
|
|
50041
50327
|
function syncDesign(claudeDir, targetBase) {
|
|
50042
|
-
const systemPromptSource =
|
|
50043
|
-
const systemPromptTarget =
|
|
50044
|
-
|
|
50328
|
+
const systemPromptSource = path107.join(claudeDir, "design-system-prompt.md");
|
|
50329
|
+
const systemPromptTarget = path107.join(targetBase, "design-system-prompt.md");
|
|
50330
|
+
fs54.copyFileSync(systemPromptSource, systemPromptTarget);
|
|
50045
50331
|
console.log(
|
|
50046
50332
|
"Copied design-system-prompt.md to ~/.claude/design-system-prompt.md"
|
|
50047
50333
|
);
|
|
50048
|
-
const skillsSource =
|
|
50049
|
-
const skillsTarget =
|
|
50050
|
-
|
|
50051
|
-
const entries =
|
|
50334
|
+
const skillsSource = path107.join(claudeDir, "skills");
|
|
50335
|
+
const skillsTarget = path107.join(targetBase, "skills");
|
|
50336
|
+
fs54.mkdirSync(skillsTarget, { recursive: true });
|
|
50337
|
+
const entries = fs54.readdirSync(skillsSource, { withFileTypes: true });
|
|
50052
50338
|
for (const entry of entries) {
|
|
50053
|
-
const source =
|
|
50054
|
-
const target =
|
|
50339
|
+
const source = path107.join(skillsSource, entry.name);
|
|
50340
|
+
const target = path107.join(skillsTarget, entry.name);
|
|
50055
50341
|
if (entry.isDirectory()) {
|
|
50056
|
-
|
|
50057
|
-
|
|
50342
|
+
fs54.rmSync(target, { recursive: true, force: true });
|
|
50343
|
+
fs54.cpSync(source, target, { recursive: true });
|
|
50058
50344
|
} else {
|
|
50059
|
-
|
|
50345
|
+
fs54.copyFileSync(source, target);
|
|
50060
50346
|
}
|
|
50061
50347
|
}
|
|
50062
50348
|
console.log(`Synced ${entries.length} skill(s) to ~/.claude/skills`);
|
|
@@ -50064,23 +50350,23 @@ function syncDesign(claudeDir, targetBase) {
|
|
|
50064
50350
|
}
|
|
50065
50351
|
|
|
50066
50352
|
// src/commands/sync/syncPi.ts
|
|
50067
|
-
import * as
|
|
50353
|
+
import * as path109 from "path";
|
|
50068
50354
|
import { stringify as stringify4 } from "yaml";
|
|
50069
50355
|
|
|
50070
50356
|
// src/commands/sync/syncPiHooks.ts
|
|
50071
|
-
import * as
|
|
50072
|
-
import * as
|
|
50357
|
+
import * as fs55 from "fs";
|
|
50358
|
+
import * as path108 from "path";
|
|
50073
50359
|
function piExtensionsDir() {
|
|
50074
|
-
return
|
|
50360
|
+
return path108.join(harnesses.pi.homeDir, "extensions");
|
|
50075
50361
|
}
|
|
50076
50362
|
function syncPiHooks(sourceDir) {
|
|
50077
50363
|
const target = piExtensionsDir();
|
|
50078
|
-
|
|
50079
|
-
const files =
|
|
50364
|
+
fs55.mkdirSync(target, { recursive: true });
|
|
50365
|
+
const files = fs55.readdirSync(sourceDir).filter((f) => f.endsWith(".ts"));
|
|
50080
50366
|
for (const file of files) {
|
|
50081
|
-
|
|
50082
|
-
|
|
50083
|
-
|
|
50367
|
+
fs55.copyFileSync(
|
|
50368
|
+
path108.join(sourceDir, file),
|
|
50369
|
+
path108.join(target, `assist-${file}`)
|
|
50084
50370
|
);
|
|
50085
50371
|
}
|
|
50086
50372
|
console.log(
|
|
@@ -50115,7 +50401,7 @@ function syncPi(claudeDir, options2) {
|
|
|
50115
50401
|
commandToPrompt
|
|
50116
50402
|
);
|
|
50117
50403
|
const designSkills = installDesignResources(claudeDir, harnesses.pi);
|
|
50118
|
-
syncPiHooks(
|
|
50404
|
+
syncPiHooks(path109.join(claudeDir, "..", "pi"));
|
|
50119
50405
|
console.log(`Synced ${synced} prompt(s) to ~/.pi/agent/prompts`);
|
|
50120
50406
|
console.log(
|
|
50121
50407
|
`Synced the design system prompt and ${designSkills.length} design skill(s) to ~/.pi/agent/assist`
|
|
@@ -50124,22 +50410,22 @@ function syncPi(claudeDir, options2) {
|
|
|
50124
50410
|
const force = options2.force ?? false;
|
|
50125
50411
|
reportPrune(
|
|
50126
50412
|
"~/.pi/agent/prompts",
|
|
50127
|
-
pruneCommands(
|
|
50413
|
+
pruneCommands(path109.join(harnesses.pi.homeDir, "prompts"), names, { force }),
|
|
50128
50414
|
force
|
|
50129
50415
|
);
|
|
50130
50416
|
}
|
|
50131
50417
|
|
|
50132
50418
|
// src/commands/sync/syncSettings.ts
|
|
50133
|
-
import * as
|
|
50134
|
-
import * as
|
|
50419
|
+
import * as fs56 from "fs";
|
|
50420
|
+
import * as path110 from "path";
|
|
50135
50421
|
import chalk289 from "chalk";
|
|
50136
50422
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
50137
|
-
const source =
|
|
50138
|
-
const target =
|
|
50139
|
-
const sourceContent =
|
|
50423
|
+
const source = path110.join(claudeDir, "settings.json");
|
|
50424
|
+
const target = path110.join(targetBase, "settings.json");
|
|
50425
|
+
const sourceContent = fs56.readFileSync(source, "utf8");
|
|
50140
50426
|
const sourceSettings = JSON.parse(sourceContent);
|
|
50141
|
-
const targetExists =
|
|
50142
|
-
const targetContent = targetExists ?
|
|
50427
|
+
const targetExists = fs56.existsSync(target);
|
|
50428
|
+
const targetContent = targetExists ? fs56.readFileSync(target, "utf8") : "";
|
|
50143
50429
|
const preservedUserSettings = targetExists ? JSON.parse(targetContent) : {};
|
|
50144
50430
|
const mergedContent = JSON.stringify(
|
|
50145
50431
|
{ ...preservedUserSettings, ...sourceSettings },
|
|
@@ -50169,23 +50455,23 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
50169
50455
|
}
|
|
50170
50456
|
}
|
|
50171
50457
|
}
|
|
50172
|
-
|
|
50458
|
+
fs56.writeFileSync(target, mergedContent);
|
|
50173
50459
|
console.log("Copied settings.json to ~/.claude/settings.json");
|
|
50174
50460
|
}
|
|
50175
50461
|
|
|
50176
50462
|
// src/commands/sync.ts
|
|
50177
50463
|
var __filename4 = fileURLToPath8(import.meta.url);
|
|
50178
|
-
var __dirname5 =
|
|
50464
|
+
var __dirname5 = path111.dirname(__filename4);
|
|
50179
50465
|
async function sync(options2) {
|
|
50180
50466
|
const config = loadConfig();
|
|
50181
50467
|
const yes = options2?.yes ?? config.sync.autoConfirm;
|
|
50182
50468
|
const prune = { prune: options2?.prune, force: options2?.force };
|
|
50183
|
-
const claudeDir =
|
|
50184
|
-
const targetBase =
|
|
50469
|
+
const claudeDir = path111.join(__dirname5, "..", "claude");
|
|
50470
|
+
const targetBase = path111.join(os6.homedir(), ".claude");
|
|
50185
50471
|
const commandNames = syncClaudeCommands(claudeDir, targetBase);
|
|
50186
50472
|
const skillDirNames = syncDesign(claudeDir, targetBase);
|
|
50187
50473
|
await syncSettings(claudeDir, targetBase, { yes });
|
|
50188
|
-
syncCodex(claudeDir, prune);
|
|
50474
|
+
await syncCodex(claudeDir, prune);
|
|
50189
50475
|
syncPi(claudeDir, prune);
|
|
50190
50476
|
reportRetiredAgentsFiles();
|
|
50191
50477
|
if (!options2?.prune) return;
|
|
@@ -50193,7 +50479,7 @@ async function sync(options2) {
|
|
|
50193
50479
|
reportPrune(
|
|
50194
50480
|
"~/.claude/skills",
|
|
50195
50481
|
pruneSkills(
|
|
50196
|
-
|
|
50482
|
+
path111.join(targetBase, "skills"),
|
|
50197
50483
|
[...commandNames, ...skillDirNames],
|
|
50198
50484
|
{ force }
|
|
50199
50485
|
),
|
|
@@ -50201,7 +50487,7 @@ async function sync(options2) {
|
|
|
50201
50487
|
);
|
|
50202
50488
|
reportPrune(
|
|
50203
50489
|
"~/.claude/commands",
|
|
50204
|
-
pruneCommands(
|
|
50490
|
+
pruneCommands(path111.join(targetBase, "commands"), [], { force }),
|
|
50205
50491
|
force
|
|
50206
50492
|
);
|
|
50207
50493
|
}
|
|
@@ -50968,12 +51254,12 @@ function adviceFragments() {
|
|
|
50968
51254
|
|
|
50969
51255
|
// src/commands/verify/blockCodeComments/findComments.ts
|
|
50970
51256
|
import { execSync as execSync62 } from "child_process";
|
|
50971
|
-
import
|
|
51257
|
+
import fs58 from "fs";
|
|
50972
51258
|
import { minimatch as minimatch9 } from "minimatch";
|
|
50973
51259
|
import { Project as Project6 } from "ts-morph";
|
|
50974
51260
|
|
|
50975
51261
|
// src/commands/verify/blockCodeComments/collectFileComments.ts
|
|
50976
|
-
import
|
|
51262
|
+
import fs57 from "fs";
|
|
50977
51263
|
|
|
50978
51264
|
// src/shared/isBicepFile.ts
|
|
50979
51265
|
var BICEP_EXTENSIONS = [".bicep", ".bicepparam"];
|
|
@@ -51122,7 +51408,7 @@ function toFindings(file, lines, raw, exempt) {
|
|
|
51122
51408
|
|
|
51123
51409
|
// src/commands/verify/blockCodeComments/collectFileComments.ts
|
|
51124
51410
|
function collectFileComments(file, lines, project) {
|
|
51125
|
-
const read4 = () =>
|
|
51411
|
+
const read4 = () => fs57.readFileSync(file, "utf8");
|
|
51126
51412
|
if (isYamlFile(file))
|
|
51127
51413
|
return toFindings(file, lines, collectYamlComments(read4()), false);
|
|
51128
51414
|
if (isDockerfile(file) || isEnvFile(file) || isShellFile(file))
|
|
@@ -51203,7 +51489,7 @@ function shouldScan(file, ignoreGlobs) {
|
|
|
51203
51489
|
if (!SCANNED_EXTENSIONS.some((ext) => file.endsWith(ext)) && !isHashCommentFile(file))
|
|
51204
51490
|
return false;
|
|
51205
51491
|
if (ignoreGlobs.some((glob) => minimatch9(file, glob))) return false;
|
|
51206
|
-
return
|
|
51492
|
+
return fs58.existsSync(file);
|
|
51207
51493
|
}
|
|
51208
51494
|
function findComments(options2) {
|
|
51209
51495
|
const diff3 = execSync62("git diff HEAD", {
|
|
@@ -51293,9 +51579,9 @@ import { existsSync as existsSync91, readFileSync as readFileSync78 } from "fs";
|
|
|
51293
51579
|
|
|
51294
51580
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
51295
51581
|
import { minimatch as minimatch10 } from "minimatch";
|
|
51296
|
-
function resolveStringsAtPath(data,
|
|
51582
|
+
function resolveStringsAtPath(data, path115) {
|
|
51297
51583
|
let current2 = data;
|
|
51298
|
-
for (const segment of
|
|
51584
|
+
for (const segment of path115.split(".")) {
|
|
51299
51585
|
if (current2 === null || typeof current2 !== "object") return [];
|
|
51300
51586
|
current2 = current2[segment];
|
|
51301
51587
|
}
|
|
@@ -51308,10 +51594,10 @@ function resolveStringsAtPath(data, path114) {
|
|
|
51308
51594
|
}
|
|
51309
51595
|
function findRuleViolations(data, rule) {
|
|
51310
51596
|
const violations = [];
|
|
51311
|
-
for (const
|
|
51312
|
-
for (const value of resolveStringsAtPath(data,
|
|
51597
|
+
for (const path115 of rule.paths) {
|
|
51598
|
+
for (const value of resolveStringsAtPath(data, path115)) {
|
|
51313
51599
|
if (minimatch10(value, rule.disallowed))
|
|
51314
|
-
violations.push({ file: rule.file, path:
|
|
51600
|
+
violations.push({ file: rule.file, path: path115, value });
|
|
51315
51601
|
}
|
|
51316
51602
|
}
|
|
51317
51603
|
return violations;
|
|
@@ -51350,8 +51636,8 @@ function forbiddenStrings() {
|
|
|
51350
51636
|
process.exit(0);
|
|
51351
51637
|
}
|
|
51352
51638
|
console.log("Forbidden strings found:\n");
|
|
51353
|
-
for (const { file, path:
|
|
51354
|
-
console.log(` ${file} ${
|
|
51639
|
+
for (const { file, path: path115, value } of violations) {
|
|
51640
|
+
console.log(` ${file} ${path115}: ${value}`);
|
|
51355
51641
|
}
|
|
51356
51642
|
console.log(`
|
|
51357
51643
|
Total: ${violations.length} forbidden string(s).`);
|
|
@@ -51409,7 +51695,7 @@ Total: ${lines.length} hardcoded color(s)`);
|
|
|
51409
51695
|
|
|
51410
51696
|
// src/commands/verify/migrations.ts
|
|
51411
51697
|
import { readFileSync as readFileSync79 } from "fs";
|
|
51412
|
-
import
|
|
51698
|
+
import path113 from "path";
|
|
51413
51699
|
|
|
51414
51700
|
// src/commands/verify/migrations/checkAppendOnly.ts
|
|
51415
51701
|
function checkAppendOnly(baseline, current2) {
|
|
@@ -51501,15 +51787,15 @@ function readBaselineMigrations(repoRelativeDir, ref) {
|
|
|
51501
51787
|
} catch {
|
|
51502
51788
|
return baseline;
|
|
51503
51789
|
}
|
|
51504
|
-
const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((
|
|
51505
|
-
for (const
|
|
51790
|
+
const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path115) => MIGRATION_FILE3.test(basename33(path115)));
|
|
51791
|
+
for (const path115 of paths) {
|
|
51506
51792
|
try {
|
|
51507
|
-
const content = execSync63(`git show "${ref}:${
|
|
51793
|
+
const content = execSync63(`git show "${ref}:${path115}"`, {
|
|
51508
51794
|
encoding: "utf8",
|
|
51509
51795
|
maxBuffer: 16 * 1024 * 1024,
|
|
51510
51796
|
stdio: ["pipe", "pipe", "pipe"]
|
|
51511
51797
|
});
|
|
51512
|
-
baseline.set(basename33(
|
|
51798
|
+
baseline.set(basename33(path115), content);
|
|
51513
51799
|
} catch {
|
|
51514
51800
|
}
|
|
51515
51801
|
}
|
|
@@ -51548,11 +51834,11 @@ function resolveBaselineRef() {
|
|
|
51548
51834
|
}
|
|
51549
51835
|
|
|
51550
51836
|
// src/commands/verify/migrations/migrationsDir.ts
|
|
51551
|
-
import
|
|
51837
|
+
import path112 from "path";
|
|
51552
51838
|
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
51553
51839
|
function migrationsDir() {
|
|
51554
|
-
return
|
|
51555
|
-
|
|
51840
|
+
return path112.resolve(
|
|
51841
|
+
path112.dirname(fileURLToPath9(import.meta.url)),
|
|
51556
51842
|
"../../../shared/db/migrations"
|
|
51557
51843
|
);
|
|
51558
51844
|
}
|
|
@@ -51573,7 +51859,7 @@ function migrations2() {
|
|
|
51573
51859
|
if (ref) {
|
|
51574
51860
|
const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
|
|
51575
51861
|
const current2 = new Map(
|
|
51576
|
-
files.map((file) => [file, readFileSync79(
|
|
51862
|
+
files.map((file) => [file, readFileSync79(path113.join(dir, file), "utf8")])
|
|
51577
51863
|
);
|
|
51578
51864
|
for (const finding of checkAppendOnly(baseline, current2)) {
|
|
51579
51865
|
problems.push(
|
|
@@ -52050,27 +52336,27 @@ function restartAdvice(paths) {
|
|
|
52050
52336
|
// src/commands/watch/syncAdvice.ts
|
|
52051
52337
|
var rules = [
|
|
52052
52338
|
{
|
|
52053
|
-
matches: (
|
|
52339
|
+
matches: (path115) => path115.startsWith("claude/commands/"),
|
|
52054
52340
|
reason: "claude/commands changed"
|
|
52055
52341
|
},
|
|
52056
52342
|
{
|
|
52057
|
-
matches: (
|
|
52343
|
+
matches: (path115) => path115.startsWith("claude/skills/"),
|
|
52058
52344
|
reason: "claude/skills changed"
|
|
52059
52345
|
},
|
|
52060
52346
|
{
|
|
52061
|
-
matches: (
|
|
52347
|
+
matches: (path115) => path115 === "claude/settings.json",
|
|
52062
52348
|
reason: "claude/settings.json changed"
|
|
52063
52349
|
},
|
|
52064
52350
|
{
|
|
52065
|
-
matches: (
|
|
52351
|
+
matches: (path115) => path115 === "claude/design-system-prompt.md",
|
|
52066
52352
|
reason: "claude/design-system-prompt.md changed"
|
|
52067
52353
|
},
|
|
52068
52354
|
{
|
|
52069
|
-
matches: (
|
|
52355
|
+
matches: (path115) => path115.startsWith("codex/"),
|
|
52070
52356
|
reason: "codex sources changed"
|
|
52071
52357
|
},
|
|
52072
52358
|
{
|
|
52073
|
-
matches: (
|
|
52359
|
+
matches: (path115) => path115.startsWith("pi/"),
|
|
52074
52360
|
reason: "pi sources changed"
|
|
52075
52361
|
}
|
|
52076
52362
|
];
|
|
@@ -52249,10 +52535,10 @@ ${buildWatchReport(from)}`);
|
|
|
52249
52535
|
|
|
52250
52536
|
// src/commands/watch/consumeMarker.ts
|
|
52251
52537
|
import { existsSync as existsSync94, rmSync as rmSync14 } from "fs";
|
|
52252
|
-
function consumeMarker(
|
|
52538
|
+
function consumeMarker(path115) {
|
|
52253
52539
|
try {
|
|
52254
|
-
if (!existsSync94(
|
|
52255
|
-
rmSync14(
|
|
52540
|
+
if (!existsSync94(path115)) return false;
|
|
52541
|
+
rmSync14(path115);
|
|
52256
52542
|
return true;
|
|
52257
52543
|
} catch {
|
|
52258
52544
|
return false;
|
|
@@ -52474,11 +52760,11 @@ function decideLap(end, interrupted) {
|
|
|
52474
52760
|
}
|
|
52475
52761
|
|
|
52476
52762
|
// src/commands/watch/runWatchLap.ts
|
|
52477
|
-
import { spawn as
|
|
52763
|
+
import { spawn as spawn12 } from "child_process";
|
|
52478
52764
|
var WATCH_LAP_ARGS = ["watch", "wait", "--pull", "--build"];
|
|
52479
52765
|
function runWatchLap() {
|
|
52480
52766
|
return new Promise((resolve35, reject) => {
|
|
52481
|
-
const assistFromPath =
|
|
52767
|
+
const assistFromPath = spawn12("assist", WATCH_LAP_ARGS, {
|
|
52482
52768
|
stdio: "inherit",
|
|
52483
52769
|
shell: process.platform === "win32"
|
|
52484
52770
|
});
|
|
@@ -52558,9 +52844,9 @@ function findPortFile(roamDir) {
|
|
|
52558
52844
|
return void 0;
|
|
52559
52845
|
}
|
|
52560
52846
|
const candidates = entries.filter((name2) => /^roam-local-api(-[^.]+)?\.port$/.test(name2)).map((name2) => {
|
|
52561
|
-
const
|
|
52847
|
+
const path115 = join115(roamDir, name2);
|
|
52562
52848
|
try {
|
|
52563
|
-
return { path:
|
|
52849
|
+
return { path: path115, mtimeMs: statSync15(path115).mtimeMs };
|
|
52564
52850
|
} catch {
|
|
52565
52851
|
return void 0;
|
|
52566
52852
|
}
|
|
@@ -52726,11 +53012,11 @@ function findLinkIndex() {
|
|
|
52726
53012
|
function parseLinkArgs() {
|
|
52727
53013
|
const idx = findLinkIndex();
|
|
52728
53014
|
if (idx === -1) return null;
|
|
52729
|
-
const
|
|
53015
|
+
const path115 = process.argv[idx + 1];
|
|
52730
53016
|
const rest = process.argv.slice(idx + 2);
|
|
52731
53017
|
const { value: prefix2 } = extractOption(rest, "--prefix");
|
|
52732
53018
|
if (!prefix2) return null;
|
|
52733
|
-
return { path:
|
|
53019
|
+
return { path: path115, prefix: prefix2 };
|
|
52734
53020
|
}
|
|
52735
53021
|
function hasDuplicateLink(runList, linkPath) {
|
|
52736
53022
|
return runList.some(
|
|
@@ -52759,7 +53045,7 @@ function link2() {
|
|
|
52759
53045
|
|
|
52760
53046
|
// src/commands/run/add.ts
|
|
52761
53047
|
import { mkdirSync as mkdirSync44, writeFileSync as writeFileSync63 } from "fs";
|
|
52762
|
-
import { dirname as
|
|
53048
|
+
import { dirname as dirname51 } from "path";
|
|
52763
53049
|
|
|
52764
53050
|
// src/commands/run/editRepoRunList.ts
|
|
52765
53051
|
async function editRepoRunList(repoName, cwd, edit2) {
|
|
@@ -52902,8 +53188,8 @@ function extractAddArgs(addIndex) {
|
|
|
52902
53188
|
const cwd = extractOption(filter.remaining, "--cwd");
|
|
52903
53189
|
const port = extractOption(cwd.remaining, "--port");
|
|
52904
53190
|
const protocol = extractOption(port.remaining, "--protocol");
|
|
52905
|
-
const
|
|
52906
|
-
const server = extractOptionalValueFlag(
|
|
53191
|
+
const path115 = extractOption(protocol.remaining, "--path");
|
|
53192
|
+
const server = extractOptionalValueFlag(path115.remaining, "--server");
|
|
52907
53193
|
const repo = extractOptionalValueFlag(server.remaining, "--repo");
|
|
52908
53194
|
return {
|
|
52909
53195
|
name: process.argv[addIndex + 1],
|
|
@@ -52914,7 +53200,7 @@ function extractAddArgs(addIndex) {
|
|
|
52914
53200
|
server: server.value,
|
|
52915
53201
|
port: parsePort(port.value),
|
|
52916
53202
|
protocol: parseProtocol(protocol.value),
|
|
52917
|
-
path:
|
|
53203
|
+
path: path115.value,
|
|
52918
53204
|
env: parseEnvPairs(env.values),
|
|
52919
53205
|
pre: pre.values.length > 0 ? pre.values : void 0,
|
|
52920
53206
|
filter: filter.value,
|
|
@@ -52955,7 +53241,7 @@ function saveProjectRunConfig(entry) {
|
|
|
52955
53241
|
}
|
|
52956
53242
|
function createCommandFile(name2) {
|
|
52957
53243
|
const filePath = runCommandFilePath(name2);
|
|
52958
|
-
mkdirSync44(
|
|
53244
|
+
mkdirSync44(dirname51(filePath), { recursive: true });
|
|
52959
53245
|
const content = `---
|
|
52960
53246
|
description: Run ${name2}
|
|
52961
53247
|
---
|
|
@@ -53083,7 +53369,7 @@ function registerRunAdd(runCommand) {
|
|
|
53083
53369
|
|
|
53084
53370
|
// src/commands/run/remove.ts
|
|
53085
53371
|
import { existsSync as existsSync95, readdirSync as readdirSync29, rmdirSync, unlinkSync as unlinkSync20 } from "fs";
|
|
53086
|
-
import { dirname as
|
|
53372
|
+
import { dirname as dirname52, join as join117 } from "path";
|
|
53087
53373
|
|
|
53088
53374
|
// src/commands/run/removeRepoRunConfig.ts
|
|
53089
53375
|
function isNamed(entry, name2) {
|
|
@@ -53102,7 +53388,7 @@ function removeRepoRunConfig(name2, repoName, cwd = process.cwd()) {
|
|
|
53102
53388
|
// src/commands/run/remove.ts
|
|
53103
53389
|
function removeEmptyNamespaceDirs(filePath) {
|
|
53104
53390
|
const root2 = join117(".claude", "commands");
|
|
53105
|
-
for (let dir =
|
|
53391
|
+
for (let dir = dirname52(filePath); dir !== root2; dir = dirname52(dir)) {
|
|
53106
53392
|
if (!existsSync95(dir) || readdirSync29(dir).length > 0) return;
|
|
53107
53393
|
rmdirSync(dir);
|
|
53108
53394
|
}
|
|
@@ -53110,10 +53396,10 @@ function removeEmptyNamespaceDirs(filePath) {
|
|
|
53110
53396
|
function deleteCommandFile(name2) {
|
|
53111
53397
|
const filePath = runCommandFilePath(name2);
|
|
53112
53398
|
const legacyPath = join117(".claude", "commands", `${name2}.md`);
|
|
53113
|
-
for (const
|
|
53114
|
-
if (existsSync95(
|
|
53115
|
-
unlinkSync20(
|
|
53116
|
-
console.log(`Deleted command file: ${
|
|
53399
|
+
for (const path115 of /* @__PURE__ */ new Set([filePath, legacyPath])) {
|
|
53400
|
+
if (existsSync95(path115)) {
|
|
53401
|
+
unlinkSync20(path115);
|
|
53402
|
+
console.log(`Deleted command file: ${path115}`);
|
|
53117
53403
|
}
|
|
53118
53404
|
}
|
|
53119
53405
|
removeEmptyNamespaceDirs(filePath);
|
|
@@ -53196,7 +53482,7 @@ function listDaemonPids() {
|
|
|
53196
53482
|
}
|
|
53197
53483
|
|
|
53198
53484
|
// src/commands/sessions/daemon/queryDaemon.ts
|
|
53199
|
-
import { createInterface as
|
|
53485
|
+
import { createInterface as createInterface8 } from "readline";
|
|
53200
53486
|
var STATUS_TIMEOUT_MS2 = 5e3;
|
|
53201
53487
|
function queryDaemon(socket) {
|
|
53202
53488
|
socket.write(`${JSON.stringify({ type: "ping" })}
|
|
@@ -53205,7 +53491,7 @@ function queryDaemon(socket) {
|
|
|
53205
53491
|
const result = { sessions: [] };
|
|
53206
53492
|
const pending = /* @__PURE__ */ new Set(["sessions", "pong"]);
|
|
53207
53493
|
const timer = setTimeout(() => resolve35(result), STATUS_TIMEOUT_MS2);
|
|
53208
|
-
const lines =
|
|
53494
|
+
const lines = createInterface8({ input: socket });
|
|
53209
53495
|
lines.on("error", () => {
|
|
53210
53496
|
});
|
|
53211
53497
|
lines.on("line", (line) => {
|
|
@@ -53299,7 +53585,7 @@ function reportStrays(pids) {
|
|
|
53299
53585
|
}
|
|
53300
53586
|
|
|
53301
53587
|
// src/commands/sessions/daemon/drainDaemon.ts
|
|
53302
|
-
import { createInterface as
|
|
53588
|
+
import { createInterface as createInterface9 } from "readline";
|
|
53303
53589
|
|
|
53304
53590
|
// src/commands/sessions/daemon/clearPersistedSessionsOnDrain.ts
|
|
53305
53591
|
function clearPersistedSessionsOnDrain() {
|
|
@@ -53341,7 +53627,7 @@ async function drainDaemon(options2 = {}) {
|
|
|
53341
53627
|
clearPersistedSessionsOnDrain();
|
|
53342
53628
|
return;
|
|
53343
53629
|
}
|
|
53344
|
-
const lines =
|
|
53630
|
+
const lines = createInterface9({ input: socket });
|
|
53345
53631
|
lines.on("error", () => {
|
|
53346
53632
|
});
|
|
53347
53633
|
const live = await liveSessions(lines);
|
|
@@ -53965,8 +54251,8 @@ function findServerParents(sessions, file) {
|
|
|
53965
54251
|
|
|
53966
54252
|
// src/commands/sessions/daemon/lastWriteTimes.ts
|
|
53967
54253
|
import { isAbsolute as isAbsolute8, resolve as resolve33 } from "path";
|
|
53968
|
-
function normalise2(
|
|
53969
|
-
const absolute2 = cwd && !isAbsolute8(
|
|
54254
|
+
function normalise2(path115, cwd) {
|
|
54255
|
+
const absolute2 = cwd && !isAbsolute8(path115) ? resolve33(cwd, path115) : path115;
|
|
53970
54256
|
return absolute2.replaceAll("\\", "/");
|
|
53971
54257
|
}
|
|
53972
54258
|
function latest(current2, at2) {
|
|
@@ -53983,10 +54269,10 @@ function lastWriteTimes(events, target, cwd) {
|
|
|
53983
54269
|
for (const event of events) {
|
|
53984
54270
|
const at2 = Date.parse(String(event.at));
|
|
53985
54271
|
if (Number.isNaN(at2)) continue;
|
|
53986
|
-
for (const
|
|
53987
|
-
if (
|
|
54272
|
+
for (const path115 of writtenPaths(event).map((p) => normalise2(p, cwd))) {
|
|
54273
|
+
if (path115.endsWith(`/${target.file}`))
|
|
53988
54274
|
result.file = latest(result.file, at2);
|
|
53989
|
-
if (
|
|
54275
|
+
if (path115.includes(`/${target.within}`))
|
|
53990
54276
|
result.within = latest(result.within, at2);
|
|
53991
54277
|
}
|
|
53992
54278
|
}
|
|
@@ -54582,12 +54868,12 @@ var ClientHub = class extends Set {
|
|
|
54582
54868
|
};
|
|
54583
54869
|
|
|
54584
54870
|
// src/commands/sessions/daemon/designSystemPromptPath.ts
|
|
54585
|
-
import * as
|
|
54871
|
+
import * as path114 from "path";
|
|
54586
54872
|
import { fileURLToPath as fileURLToPath10 } from "url";
|
|
54587
54873
|
var __filename5 = fileURLToPath10(import.meta.url);
|
|
54588
|
-
var __dirname6 =
|
|
54874
|
+
var __dirname6 = path114.dirname(__filename5);
|
|
54589
54875
|
function designSystemPromptPath() {
|
|
54590
|
-
return
|
|
54876
|
+
return path114.join(__dirname6, "..", "claude", "design-system-prompt.md");
|
|
54591
54877
|
}
|
|
54592
54878
|
|
|
54593
54879
|
// src/commands/sessions/daemon/sessionModeLaunch.ts
|
|
@@ -54872,26 +55158,26 @@ import { readFileSync as readFileSync82, writeFileSync as writeFileSync65 } from
|
|
|
54872
55158
|
var KEEP_TAIL = 256 * 1024;
|
|
54873
55159
|
var MAX_LOG_SIZE = 4 * 1024 * 1024;
|
|
54874
55160
|
function trimWatcherLog(cwd) {
|
|
54875
|
-
const
|
|
55161
|
+
const path115 = watcherLogPath(cwd);
|
|
54876
55162
|
let log2;
|
|
54877
55163
|
try {
|
|
54878
|
-
log2 = readFileSync82(
|
|
55164
|
+
log2 = readFileSync82(path115, "utf8");
|
|
54879
55165
|
} catch {
|
|
54880
55166
|
return;
|
|
54881
55167
|
}
|
|
54882
55168
|
if (log2.length <= MAX_LOG_SIZE) return;
|
|
54883
|
-
writeFileSync65(
|
|
54884
|
-
daemonLog(`auto-update: log ${
|
|
55169
|
+
writeFileSync65(path115, log2.slice(-KEEP_TAIL));
|
|
55170
|
+
daemonLog(`auto-update: log ${path115} trimmed to its last ${KEEP_TAIL} chars`);
|
|
54885
55171
|
}
|
|
54886
55172
|
|
|
54887
55173
|
// src/commands/sessions/daemon/worktree/appendWatcherLog.ts
|
|
54888
55174
|
import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync45 } from "fs";
|
|
54889
|
-
import { dirname as
|
|
55175
|
+
import { dirname as dirname54 } from "path";
|
|
54890
55176
|
function appendWatcherLog(cwd, data) {
|
|
54891
55177
|
try {
|
|
54892
|
-
const
|
|
54893
|
-
mkdirSync45(
|
|
54894
|
-
appendFileSync4(
|
|
55178
|
+
const path115 = watcherLogPath(cwd);
|
|
55179
|
+
mkdirSync45(dirname54(path115), { recursive: true });
|
|
55180
|
+
appendFileSync4(path115, data);
|
|
54895
55181
|
} catch {
|
|
54896
55182
|
}
|
|
54897
55183
|
}
|
|
@@ -54907,27 +55193,27 @@ function detectExistingWorktree(cwd) {
|
|
|
54907
55193
|
|
|
54908
55194
|
// src/commands/sessions/daemon/worktree/noteWorktreeHarness.ts
|
|
54909
55195
|
function noteWorktreeHarness(session) {
|
|
54910
|
-
const
|
|
54911
|
-
if (!
|
|
55196
|
+
const path115 = session.worktree?.path;
|
|
55197
|
+
if (!path115) return;
|
|
54912
55198
|
const harness = session.commandType === "claude" ? resolveHarness(session.harness) : session.harness;
|
|
54913
55199
|
if (!harness) return;
|
|
54914
55200
|
try {
|
|
54915
|
-
recordWorktreeHarness(
|
|
55201
|
+
recordWorktreeHarness(path115, harness);
|
|
54916
55202
|
} catch (error) {
|
|
54917
55203
|
daemonLog(
|
|
54918
|
-
`worktree ${
|
|
55204
|
+
`worktree ${path115} harness ${harness} not recorded for session ${session.id}: ${error instanceof Error ? error.message : String(error)}`
|
|
54919
55205
|
);
|
|
54920
55206
|
}
|
|
54921
55207
|
}
|
|
54922
55208
|
|
|
54923
55209
|
// src/commands/sessions/daemon/worktree/refuseUnallocatedStart.ts
|
|
54924
|
-
function refuseUnallocatedStart(session,
|
|
55210
|
+
function refuseUnallocatedStart(session, path115, error, startHeld) {
|
|
54925
55211
|
const reason4 = error instanceof Error ? error.message : String(error);
|
|
54926
55212
|
daemonLog(
|
|
54927
|
-
`session ${session.id} worktree ${
|
|
55213
|
+
`session ${session.id} worktree ${path115} could not be created: ${reason4}`
|
|
54928
55214
|
);
|
|
54929
55215
|
session.pendingStart = () => {
|
|
54930
|
-
throw new Error(`worktree ${
|
|
55216
|
+
throw new Error(`worktree ${path115} could not be created: ${reason4}`);
|
|
54931
55217
|
};
|
|
54932
55218
|
startHeld(session);
|
|
54933
55219
|
}
|
|
@@ -54949,9 +55235,9 @@ function bindNewWorktree(session, alloc, notify2, startHeld = () => {
|
|
|
54949
55235
|
}
|
|
54950
55236
|
notify2();
|
|
54951
55237
|
}
|
|
54952
|
-
function seedHeldSession(session,
|
|
55238
|
+
function seedHeldSession(session, path115, clone, notify2, startHeld) {
|
|
54953
55239
|
seedWorktree(
|
|
54954
|
-
|
|
55240
|
+
path115,
|
|
54955
55241
|
clone,
|
|
54956
55242
|
() => {
|
|
54957
55243
|
session.seeding = void 0;
|
|
@@ -54984,8 +55270,8 @@ import { existsSync as existsSync100 } from "fs";
|
|
|
54984
55270
|
// src/commands/sessions/daemon/worktree/holdsNoCheckout.ts
|
|
54985
55271
|
import { existsSync as existsSync99 } from "fs";
|
|
54986
55272
|
import { join as join120 } from "path";
|
|
54987
|
-
function holdsNoCheckout(
|
|
54988
|
-
return existsSync99(
|
|
55273
|
+
function holdsNoCheckout(path115) {
|
|
55274
|
+
return existsSync99(path115) && !existsSync99(join120(path115, ".git"));
|
|
54989
55275
|
}
|
|
54990
55276
|
|
|
54991
55277
|
// src/commands/sessions/daemon/worktree/treeDurability.ts
|
|
@@ -55187,19 +55473,19 @@ function noteAutoUpdate(installDir, text19) {
|
|
|
55187
55473
|
}
|
|
55188
55474
|
|
|
55189
55475
|
// src/commands/sessions/daemon/autoUpdate/runUpdateLap.ts
|
|
55190
|
-
import { spawn as
|
|
55476
|
+
import { spawn as spawn13 } from "child_process";
|
|
55191
55477
|
import { rmSync as rmSync16 } from "fs";
|
|
55192
55478
|
function clearLapSignals(cwd) {
|
|
55193
55479
|
const control = watchControlPaths(cwd);
|
|
55194
55480
|
if (!control) return;
|
|
55195
|
-
for (const
|
|
55196
|
-
rmSync16(
|
|
55481
|
+
for (const path115 of [control.check, control.stop])
|
|
55482
|
+
rmSync16(path115, { force: true });
|
|
55197
55483
|
}
|
|
55198
55484
|
function runUpdateLap(cwd, onOutput) {
|
|
55199
55485
|
clearLapSignals(cwd);
|
|
55200
55486
|
return new Promise((resolve35, reject) => {
|
|
55201
55487
|
const { ASSIST_ACTIVITY_ID: _activity, ...env } = process.env;
|
|
55202
|
-
const child =
|
|
55488
|
+
const child = spawn13(
|
|
55203
55489
|
process.execPath,
|
|
55204
55490
|
[process.argv[1], ...WATCH_LAP_ARGS],
|
|
55205
55491
|
{
|
|
@@ -55530,11 +55816,11 @@ function holdFailedDiscard(session, reason4, notify2) {
|
|
|
55530
55816
|
notify2();
|
|
55531
55817
|
}
|
|
55532
55818
|
function releaseUndeletableLeftover(session, reason4, notify2) {
|
|
55533
|
-
const
|
|
55819
|
+
const path115 = session.worktree?.path;
|
|
55534
55820
|
daemonLog(
|
|
55535
|
-
`session ${session.id} discard could not delete ${
|
|
55821
|
+
`session ${session.id} discard could not delete ${path115}, which holds no git checkout and so no work: ${reason4}; card released to error so it can be dismissed`
|
|
55536
55822
|
);
|
|
55537
|
-
const message4 = `Discard could not delete ${
|
|
55823
|
+
const message4 = `Discard could not delete ${path115}: ${reason4}`;
|
|
55538
55824
|
if (session.worktree) session.releasedFromClone = session.worktree.clone;
|
|
55539
55825
|
session.worktree = void 0;
|
|
55540
55826
|
session.closing = void 0;
|
|
@@ -55761,7 +56047,7 @@ function underVsCode(pid, procRoot) {
|
|
|
55761
56047
|
let current2 = pid;
|
|
55762
56048
|
for (let depth = 0; current2 && current2 > 1 && depth < MAX_ANCESTORS; depth++) {
|
|
55763
56049
|
const cmdline = readProc(procRoot, current2, "cmdline");
|
|
55764
|
-
if (cmdline && VSCODE_PATHS.some((
|
|
56050
|
+
if (cmdline && VSCODE_PATHS.some((path115) => cmdline.includes(path115)))
|
|
55765
56051
|
return true;
|
|
55766
56052
|
current2 = parentPid(readProc(procRoot, current2, "stat"));
|
|
55767
56053
|
}
|
|
@@ -56609,7 +56895,7 @@ function handleRefusedRun(session, exitCode, onStatusChange) {
|
|
|
56609
56895
|
|
|
56610
56896
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
56611
56897
|
import { existsSync as existsSync105, mkdirSync as mkdirSync46, watch as watch2 } from "fs";
|
|
56612
|
-
import { dirname as
|
|
56898
|
+
import { dirname as dirname55 } from "path";
|
|
56613
56899
|
|
|
56614
56900
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
56615
56901
|
function applyActivityToSession(session, activity2) {
|
|
@@ -56792,8 +57078,8 @@ async function seedRunningMsFromUsage(session, notify2) {
|
|
|
56792
57078
|
var DEBOUNCE_MS2 = 50;
|
|
56793
57079
|
function watchActivity(session, notify2, onConversation) {
|
|
56794
57080
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
56795
|
-
const
|
|
56796
|
-
const dir =
|
|
57081
|
+
const path115 = activityPath(session.id);
|
|
57082
|
+
const dir = dirname55(path115);
|
|
56797
57083
|
try {
|
|
56798
57084
|
mkdirSync46(dir, { recursive: true });
|
|
56799
57085
|
} catch {
|
|
@@ -56803,7 +57089,7 @@ function watchActivity(session, notify2, onConversation) {
|
|
|
56803
57089
|
let timer = null;
|
|
56804
57090
|
const read4 = () => {
|
|
56805
57091
|
timer = null;
|
|
56806
|
-
const activity2 = readActivity(
|
|
57092
|
+
const activity2 = readActivity(path115);
|
|
56807
57093
|
if (!activity2) return;
|
|
56808
57094
|
applyLaunchActivity(session, activity2, notify2, onConversation);
|
|
56809
57095
|
if (activity2.claudeSessionId) onConversation?.(session);
|
|
@@ -56812,11 +57098,11 @@ function watchActivity(session, notify2, onConversation) {
|
|
|
56812
57098
|
notify2();
|
|
56813
57099
|
};
|
|
56814
57100
|
session.activityWatcher = watch2(dir, (_event, filename) => {
|
|
56815
|
-
if (filename && !
|
|
57101
|
+
if (filename && !path115.endsWith(filename)) return;
|
|
56816
57102
|
if (timer) clearTimeout(timer);
|
|
56817
57103
|
timer = setTimeout(read4, DEBOUNCE_MS2);
|
|
56818
57104
|
});
|
|
56819
|
-
if (existsSync105(
|
|
57105
|
+
if (existsSync105(path115)) read4();
|
|
56820
57106
|
}
|
|
56821
57107
|
function refreshActivity(session) {
|
|
56822
57108
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -57187,7 +57473,7 @@ function makeSessionSpawner(sessions, clients, counter, onStatusChange, notify2)
|
|
|
57187
57473
|
}
|
|
57188
57474
|
|
|
57189
57475
|
// src/commands/sessions/shared/transcriptUsage.ts
|
|
57190
|
-
import * as
|
|
57476
|
+
import * as fs59 from "fs";
|
|
57191
57477
|
function transcriptUsage(lines) {
|
|
57192
57478
|
const byId = /* @__PURE__ */ new Map();
|
|
57193
57479
|
for (const line of lines) {
|
|
@@ -57211,7 +57497,7 @@ function transcriptUsage(lines) {
|
|
|
57211
57497
|
return [...byId.values()];
|
|
57212
57498
|
}
|
|
57213
57499
|
async function readTranscriptUsage(transcriptPath) {
|
|
57214
|
-
const content = await
|
|
57500
|
+
const content = await fs59.promises.readFile(transcriptPath, "utf8");
|
|
57215
57501
|
return transcriptUsage(content.split("\n"));
|
|
57216
57502
|
}
|
|
57217
57503
|
|
|
@@ -57580,13 +57866,13 @@ var WIP_COMMIT = [
|
|
|
57580
57866
|
"-m",
|
|
57581
57867
|
"assist transfer WIP"
|
|
57582
57868
|
];
|
|
57583
|
-
async function currentBranch6(
|
|
57584
|
-
const branch2 = await gitOrNull(
|
|
57869
|
+
async function currentBranch6(path115, treeRoot) {
|
|
57870
|
+
const branch2 = await gitOrNull(path115, ["symbolic-ref", "--short", "HEAD"]);
|
|
57585
57871
|
if (!branch2 || treeRoot && branch2 === basename35(treeRoot)) return void 0;
|
|
57586
57872
|
return branch2;
|
|
57587
57873
|
}
|
|
57588
|
-
async function upstreamBranch2(
|
|
57589
|
-
const upstream = await gitOrNull(
|
|
57874
|
+
async function upstreamBranch2(path115) {
|
|
57875
|
+
const upstream = await gitOrNull(path115, [
|
|
57590
57876
|
"rev-parse",
|
|
57591
57877
|
"--abbrev-ref",
|
|
57592
57878
|
"--symbolic-full-name",
|
|
@@ -57595,32 +57881,32 @@ async function upstreamBranch2(path114) {
|
|
|
57595
57881
|
if (!upstream?.startsWith("origin/")) return void 0;
|
|
57596
57882
|
return upstream.slice("origin/".length);
|
|
57597
57883
|
}
|
|
57598
|
-
async function pushTransferSnapshot(
|
|
57884
|
+
async function pushTransferSnapshot(path115, itemId2, treeRoot) {
|
|
57599
57885
|
const ref = transferRefFor(itemId2);
|
|
57600
|
-
const branch2 = await currentBranch6(
|
|
57601
|
-
const upstream = await upstreamBranch2(
|
|
57602
|
-
const head = (await git2(
|
|
57603
|
-
await git2(
|
|
57886
|
+
const branch2 = await currentBranch6(path115, treeRoot);
|
|
57887
|
+
const upstream = await upstreamBranch2(path115);
|
|
57888
|
+
const head = (await git2(path115, ["rev-parse", "HEAD"])).trim();
|
|
57889
|
+
await git2(path115, ["add", "-A"]);
|
|
57604
57890
|
try {
|
|
57605
|
-
await git2(
|
|
57891
|
+
await git2(path115, WIP_COMMIT);
|
|
57606
57892
|
await git2(
|
|
57607
|
-
|
|
57893
|
+
path115,
|
|
57608
57894
|
["push", "--no-verify", "--force", "origin", `HEAD:refs/heads/${ref}`],
|
|
57609
57895
|
PUSH_TIMEOUT_MS
|
|
57610
57896
|
);
|
|
57611
57897
|
} finally {
|
|
57612
|
-
await git2(
|
|
57898
|
+
await git2(path115, ["reset", "--mixed", "--quiet", head]);
|
|
57613
57899
|
}
|
|
57614
57900
|
return { ref, branch: branch2, upstream };
|
|
57615
57901
|
}
|
|
57616
57902
|
|
|
57617
57903
|
// src/commands/sessions/daemon/transfer/snapshotTree.ts
|
|
57618
57904
|
async function snapshotTree(s, args, traceId) {
|
|
57619
|
-
const
|
|
57620
|
-
if (!
|
|
57621
|
-
const snapshot2 = await pushTransferSnapshot(
|
|
57905
|
+
const path115 = s.worktree?.path ?? s.cwd;
|
|
57906
|
+
if (!path115) return void 0;
|
|
57907
|
+
const snapshot2 = await pushTransferSnapshot(path115, args[2], s.worktree?.path);
|
|
57622
57908
|
daemonLog(
|
|
57623
|
-
`session ${s.id} pushed ${
|
|
57909
|
+
`session ${s.id} pushed ${path115} to ${snapshot2.ref} (branch=${snapshot2.branch ?? "tree"} upstream=${snapshot2.upstream ?? "none"}) trace=${traceId}`
|
|
57624
57910
|
);
|
|
57625
57911
|
return snapshot2;
|
|
57626
57912
|
}
|
|
@@ -58208,22 +58494,22 @@ function deferralNotice(persisted, cap2) {
|
|
|
58208
58494
|
}
|
|
58209
58495
|
|
|
58210
58496
|
// src/commands/sessions/daemon/worktree/underTempRoot.ts
|
|
58211
|
-
import { realpathSync as
|
|
58497
|
+
import { realpathSync as realpathSync4 } from "fs";
|
|
58212
58498
|
import { tmpdir as tmpdir9 } from "os";
|
|
58213
58499
|
import { sep as sep6 } from "path";
|
|
58214
58500
|
function tempRoots() {
|
|
58215
58501
|
const raw = tmpdir9();
|
|
58216
58502
|
const roots = /* @__PURE__ */ new Set([raw]);
|
|
58217
58503
|
try {
|
|
58218
|
-
roots.add(
|
|
58504
|
+
roots.add(realpathSync4(raw));
|
|
58219
58505
|
} catch {
|
|
58220
58506
|
return [...roots];
|
|
58221
58507
|
}
|
|
58222
58508
|
return [...roots];
|
|
58223
58509
|
}
|
|
58224
|
-
function underTempRoot(
|
|
58510
|
+
function underTempRoot(path115) {
|
|
58225
58511
|
return tempRoots().some(
|
|
58226
|
-
(root2) =>
|
|
58512
|
+
(root2) => path115.startsWith(root2.endsWith(sep6) ? root2 : root2 + sep6)
|
|
58227
58513
|
);
|
|
58228
58514
|
}
|
|
58229
58515
|
|
|
@@ -58745,15 +59031,15 @@ function accountedTrees(sessions) {
|
|
|
58745
59031
|
import { existsSync as existsSync106 } from "fs";
|
|
58746
59032
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
58747
59033
|
if (!existsSync106(clone)) {
|
|
58748
|
-
for (const { path:
|
|
59034
|
+
for (const { path: path115 } of paths) forgetWorktree(path115);
|
|
58749
59035
|
daemonLog(
|
|
58750
59036
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
58751
59037
|
);
|
|
58752
59038
|
return;
|
|
58753
59039
|
}
|
|
58754
59040
|
await pruneBookkeeping2(clone);
|
|
58755
|
-
for (const { path:
|
|
58756
|
-
if (await reclaimBranch(clone, branch2)) forgetWorktree(
|
|
59041
|
+
for (const { path: path115, branch: branch2 } of paths)
|
|
59042
|
+
if (await reclaimBranch(clone, branch2)) forgetWorktree(path115);
|
|
58757
59043
|
}
|
|
58758
59044
|
async function pruneBookkeeping2(clone) {
|
|
58759
59045
|
try {
|
|
@@ -58780,37 +59066,37 @@ async function reclaimBranch(clone, branch2) {
|
|
|
58780
59066
|
}
|
|
58781
59067
|
|
|
58782
59068
|
// src/commands/sessions/daemon/worktree/logVanishedTree.ts
|
|
58783
|
-
function logVanishedTree(sessions,
|
|
59069
|
+
function logVanishedTree(sessions, path115) {
|
|
58784
59070
|
const claimants = [...sessions.values()].filter(
|
|
58785
|
-
(s) => s.cwd ===
|
|
59071
|
+
(s) => s.cwd === path115 || s.worktree?.path === path115
|
|
58786
59072
|
);
|
|
58787
59073
|
if (claimants.length === 0) {
|
|
58788
|
-
daemonLog(`worktree ${
|
|
59074
|
+
daemonLog(`worktree ${path115} gone from disk and unclaimed; reclaiming it`);
|
|
58789
59075
|
return;
|
|
58790
59076
|
}
|
|
58791
59077
|
for (const s of claimants)
|
|
58792
59078
|
daemonLog(
|
|
58793
|
-
`session ${s.id} ("${s.name}") claims worktree ${
|
|
59079
|
+
`session ${s.id} ("${s.name}") claims worktree ${path115}, which is gone from disk; reclaiming it`
|
|
58794
59080
|
);
|
|
58795
59081
|
}
|
|
58796
59082
|
|
|
58797
59083
|
// src/commands/sessions/daemon/worktree/describeHeldWork.ts
|
|
58798
59084
|
var MAX_ITEMS = 20;
|
|
58799
|
-
async function describeHeldWork(
|
|
58800
|
-
if (reason4.startsWith("uncommitted")) return await changedFiles(
|
|
58801
|
-
if (reason4.startsWith("unpushed")) return await unpushedCommits(
|
|
59085
|
+
async function describeHeldWork(path115, reason4) {
|
|
59086
|
+
if (reason4.startsWith("uncommitted")) return await changedFiles(path115);
|
|
59087
|
+
if (reason4.startsWith("unpushed")) return await unpushedCommits(path115, reason4);
|
|
58802
59088
|
return { summary: reason4, items: [] };
|
|
58803
59089
|
}
|
|
58804
|
-
async function changedFiles(
|
|
58805
|
-
const status2 = await gitResult(
|
|
59090
|
+
async function changedFiles(path115) {
|
|
59091
|
+
const status2 = await gitResult(path115, ["status", "--porcelain"]);
|
|
58806
59092
|
const lines = status2.ok ? nonEmptyLines(status2.out) : [];
|
|
58807
59093
|
return {
|
|
58808
59094
|
summary: `${lines.length} uncommitted ${lines.length === 1 ? "file" : "files"}`,
|
|
58809
59095
|
items: capped2(lines)
|
|
58810
59096
|
};
|
|
58811
59097
|
}
|
|
58812
|
-
async function unpushedCommits(
|
|
58813
|
-
const log2 = await gitResult(
|
|
59098
|
+
async function unpushedCommits(path115, reason4) {
|
|
59099
|
+
const log2 = await gitResult(path115, ["log", "--oneline", "@{upstream}..HEAD"]);
|
|
58814
59100
|
if (!log2.ok) return { summary: reason4, items: [] };
|
|
58815
59101
|
const lines = nonEmptyLines(log2.out);
|
|
58816
59102
|
return {
|
|
@@ -58903,24 +59189,24 @@ function reconcileWorktreesOnRestore(sessions, spawnWith, notify2) {
|
|
|
58903
59189
|
async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
58904
59190
|
const accounted = accountedTrees(sessions);
|
|
58905
59191
|
const vanished = /* @__PURE__ */ new Map();
|
|
58906
|
-
for (const { path:
|
|
58907
|
-
if (underTempRoot(
|
|
58908
|
-
forgetWorktree(
|
|
59192
|
+
for (const { path: path115, clone, harness } of readWorktreeRegistry()) {
|
|
59193
|
+
if (underTempRoot(path115)) {
|
|
59194
|
+
forgetWorktree(path115);
|
|
58909
59195
|
daemonLog(
|
|
58910
|
-
`worktree ${
|
|
59196
|
+
`worktree ${path115} lies outside any project root; pruned from the registry rather than recovered`
|
|
58911
59197
|
);
|
|
58912
59198
|
continue;
|
|
58913
59199
|
}
|
|
58914
|
-
if (!existsSync107(
|
|
58915
|
-
logVanishedTree(sessions,
|
|
59200
|
+
if (!existsSync107(path115)) {
|
|
59201
|
+
logVanishedTree(sessions, path115);
|
|
58916
59202
|
vanished.set(clone, [
|
|
58917
59203
|
...vanished.get(clone) ?? [],
|
|
58918
|
-
{ path:
|
|
59204
|
+
{ path: path115, branch: basename37(path115) }
|
|
58919
59205
|
]);
|
|
58920
59206
|
continue;
|
|
58921
59207
|
}
|
|
58922
|
-
if (accounted.has(
|
|
58923
|
-
await recoverOrphan(sessions, spawnWith, { path:
|
|
59208
|
+
if (accounted.has(path115)) continue;
|
|
59209
|
+
await recoverOrphan(sessions, spawnWith, { path: path115, clone, harness }, notify2);
|
|
58924
59210
|
}
|
|
58925
59211
|
for (const [clone, paths] of vanished)
|
|
58926
59212
|
await reclaimVanishedWorktrees(clone, paths);
|
|
@@ -58938,13 +59224,13 @@ function startHeldInTree(seeded, sessions, clients, onStatusChange, notify2) {
|
|
|
58938
59224
|
// src/commands/sessions/daemon/worktree/reseedRestoredWorktrees.ts
|
|
58939
59225
|
function reseedRestoredWorktrees(deps2) {
|
|
58940
59226
|
const { sessions, clients, onStatusChange, notify: notify2 } = deps2;
|
|
58941
|
-
for (const [
|
|
59227
|
+
for (const [path115, { session, clone }] of heldTrees(sessions)) {
|
|
58942
59228
|
daemonLog(
|
|
58943
|
-
`session ${session.id} ("${session.name}") restored mid worktree setup; re-seeding ${
|
|
59229
|
+
`session ${session.id} ("${session.name}") restored mid worktree setup; re-seeding ${path115} before starting it`
|
|
58944
59230
|
);
|
|
58945
59231
|
seedHeldSession(
|
|
58946
59232
|
session,
|
|
58947
|
-
|
|
59233
|
+
path115,
|
|
58948
59234
|
clone,
|
|
58949
59235
|
notify2,
|
|
58950
59236
|
(seeded) => startHeldInTree(seeded, sessions, clients, onStatusChange, notify2)
|
|
@@ -58977,10 +59263,10 @@ function restoreAllSessions(spawner, deps2) {
|
|
|
58977
59263
|
|
|
58978
59264
|
// src/commands/sessions/daemon/retrySession.ts
|
|
58979
59265
|
function retrySession(session, clients, onStatusChange) {
|
|
58980
|
-
const
|
|
58981
|
-
if (!
|
|
59266
|
+
const spawn14 = respawnThunk(session);
|
|
59267
|
+
if (!spawn14) return false;
|
|
58982
59268
|
const respawn = () => {
|
|
58983
|
-
respawnSession(session,
|
|
59269
|
+
respawnSession(session, spawn14, "running", clients, onStatusChange);
|
|
58984
59270
|
daemonLog(`session ${session.id} retried: ${session.name}`);
|
|
58985
59271
|
};
|
|
58986
59272
|
const pty2 = session.pty;
|
|
@@ -60440,13 +60726,13 @@ import {
|
|
|
60440
60726
|
} from "fs";
|
|
60441
60727
|
var MB = 1024 * 1024;
|
|
60442
60728
|
function trimDaemonLog({
|
|
60443
|
-
path:
|
|
60729
|
+
path: path115 = daemonPaths.log,
|
|
60444
60730
|
maxBytes = 50 * MB,
|
|
60445
60731
|
keepBytes = 25 * MB
|
|
60446
60732
|
} = {}) {
|
|
60447
60733
|
let fd;
|
|
60448
60734
|
try {
|
|
60449
|
-
fd = openSync8(
|
|
60735
|
+
fd = openSync8(path115, "r+");
|
|
60450
60736
|
} catch {
|
|
60451
60737
|
return void 0;
|
|
60452
60738
|
}
|
|
@@ -60506,7 +60792,7 @@ function exitAfterFlush(code) {
|
|
|
60506
60792
|
}
|
|
60507
60793
|
|
|
60508
60794
|
// src/commands/sessions/daemon/handleConnection.ts
|
|
60509
|
-
import { createInterface as
|
|
60795
|
+
import { createInterface as createInterface11 } from "readline";
|
|
60510
60796
|
|
|
60511
60797
|
// src/commands/sessions/daemon/routed.ts
|
|
60512
60798
|
function routed(local) {
|
|
@@ -60612,7 +60898,7 @@ var handleWebLog = (client, _m, d) => {
|
|
|
60612
60898
|
};
|
|
60613
60899
|
|
|
60614
60900
|
// src/commands/sessions/daemon/historySearch/findTranscriptMatch.ts
|
|
60615
|
-
import * as
|
|
60901
|
+
import * as fs60 from "fs";
|
|
60616
60902
|
import * as readline5 from "readline";
|
|
60617
60903
|
|
|
60618
60904
|
// src/commands/sessions/daemon/historySearch/historySnippet.ts
|
|
@@ -60673,7 +60959,7 @@ function queryPattern(query) {
|
|
|
60673
60959
|
async function findTranscriptMatch(filePath, harness, query) {
|
|
60674
60960
|
const pattern2 = queryPattern(query);
|
|
60675
60961
|
const mayMatch = rawLinePrefilter(query);
|
|
60676
|
-
const stream =
|
|
60962
|
+
const stream = fs60.createReadStream(filePath, { encoding: "utf8" });
|
|
60677
60963
|
const reader = readline5.createInterface({
|
|
60678
60964
|
input: stream,
|
|
60679
60965
|
crlfDelay: Infinity
|
|
@@ -60745,7 +61031,7 @@ async function handleSearchHistory(client, data) {
|
|
|
60745
61031
|
}
|
|
60746
61032
|
|
|
60747
61033
|
// src/commands/sessions/daemon/creator.ts
|
|
60748
|
-
function creator(isNew,
|
|
61034
|
+
function creator(isNew, spawn14) {
|
|
60749
61035
|
const reply2 = (client, d, result) => {
|
|
60750
61036
|
const traceId = typeof d.traceId === "string" ? d.traceId : void 0;
|
|
60751
61037
|
if (typeof result !== "string") {
|
|
@@ -60763,7 +61049,7 @@ function creator(isNew, spawn13) {
|
|
|
60763
61049
|
if (m.links.route(client, d)) return;
|
|
60764
61050
|
let result;
|
|
60765
61051
|
try {
|
|
60766
|
-
result =
|
|
61052
|
+
result = spawn14(m, d);
|
|
60767
61053
|
} catch (error) {
|
|
60768
61054
|
fail15(client, d, error);
|
|
60769
61055
|
return;
|
|
@@ -60778,7 +61064,7 @@ function creator(isNew, spawn13) {
|
|
|
60778
61064
|
}
|
|
60779
61065
|
|
|
60780
61066
|
// src/commands/sessions/shared/codex/codexRolloutUsage.ts
|
|
60781
|
-
import * as
|
|
61067
|
+
import * as fs61 from "fs";
|
|
60782
61068
|
|
|
60783
61069
|
// src/commands/sessions/shared/codex/applyTokenInfo.ts
|
|
60784
61070
|
function applyTokenInfo(usage, byId, conversationId, rawInfo) {
|
|
@@ -60841,7 +61127,7 @@ function codexRolloutUsage(lines) {
|
|
|
60841
61127
|
return usage;
|
|
60842
61128
|
}
|
|
60843
61129
|
async function readCodexRolloutUsage(rolloutPath) {
|
|
60844
|
-
const content = await
|
|
61130
|
+
const content = await fs61.promises.readFile(rolloutPath, "utf8");
|
|
60845
61131
|
return codexRolloutUsage(content.split("\n"));
|
|
60846
61132
|
}
|
|
60847
61133
|
function sessionMetaId(entry) {
|
|
@@ -61086,7 +61372,7 @@ var handleUserActivity = (client, m, d) => {
|
|
|
61086
61372
|
};
|
|
61087
61373
|
|
|
61088
61374
|
// src/commands/sessions/shared/parseTranscript.ts
|
|
61089
|
-
import * as
|
|
61375
|
+
import * as fs62 from "fs";
|
|
61090
61376
|
|
|
61091
61377
|
// src/commands/sessions/shared/codex/parseCodexTranscriptLines.ts
|
|
61092
61378
|
function parseCodexTranscriptLines(lines) {
|
|
@@ -61149,7 +61435,7 @@ async function parseTranscript(sessionId2) {
|
|
|
61149
61435
|
}
|
|
61150
61436
|
async function readMessages(filePath, parse5) {
|
|
61151
61437
|
try {
|
|
61152
|
-
const raw = await
|
|
61438
|
+
const raw = await fs62.promises.readFile(filePath, "utf8");
|
|
61153
61439
|
return parse5(raw.split("\n"));
|
|
61154
61440
|
} catch {
|
|
61155
61441
|
return [];
|
|
@@ -61491,48 +61777,48 @@ async function confirmTransferredRun(sessions, id, trace) {
|
|
|
61491
61777
|
|
|
61492
61778
|
// src/commands/sessions/daemon/transfer/restoreTransferSnapshot.ts
|
|
61493
61779
|
var FETCH_TIMEOUT_MS2 = 12e4;
|
|
61494
|
-
async function switchToSnapshot(
|
|
61780
|
+
async function switchToSnapshot(path115, snapshot2, sha) {
|
|
61495
61781
|
const { branch: branch2 } = snapshot2;
|
|
61496
|
-
if (!branch2 || branch2 === await remoteDefaultBranch(
|
|
61497
|
-
await git2(
|
|
61498
|
-
return await gitOrNull(
|
|
61782
|
+
if (!branch2 || branch2 === await remoteDefaultBranch(path115)) {
|
|
61783
|
+
await git2(path115, ["reset", "--hard", "--quiet", sha]);
|
|
61784
|
+
return await gitOrNull(path115, ["symbolic-ref", "--short", "HEAD"]) ?? sha;
|
|
61499
61785
|
}
|
|
61500
|
-
await git2(
|
|
61786
|
+
await git2(path115, ["checkout", "--quiet", "-B", branch2, sha]);
|
|
61501
61787
|
return branch2;
|
|
61502
61788
|
}
|
|
61503
|
-
async function trackUpstream(
|
|
61504
|
-
await gitResult(
|
|
61505
|
-
const tracked = await gitResult(
|
|
61789
|
+
async function trackUpstream(path115, upstream) {
|
|
61790
|
+
await gitResult(path115, ["fetch", "--quiet", "origin", upstream]);
|
|
61791
|
+
const tracked = await gitResult(path115, [
|
|
61506
61792
|
"branch",
|
|
61507
61793
|
`--set-upstream-to=origin/${upstream}`
|
|
61508
61794
|
]);
|
|
61509
61795
|
if (!tracked.ok)
|
|
61510
61796
|
daemonLog(
|
|
61511
|
-
`transfer restore ${
|
|
61797
|
+
`transfer restore ${path115}: could not track origin/${upstream}: ${tracked.error}`
|
|
61512
61798
|
);
|
|
61513
61799
|
}
|
|
61514
|
-
async function restoreTransferSnapshot(
|
|
61515
|
-
if (await gitOrNull(
|
|
61516
|
-
throw new Error(`${
|
|
61800
|
+
async function restoreTransferSnapshot(path115, snapshot2) {
|
|
61801
|
+
if (await gitOrNull(path115, ["status", "--porcelain"]))
|
|
61802
|
+
throw new Error(`${path115} has uncommitted changes`);
|
|
61517
61803
|
await git2(
|
|
61518
|
-
|
|
61804
|
+
path115,
|
|
61519
61805
|
["fetch", "--quiet", "origin", `refs/heads/${snapshot2.ref}`],
|
|
61520
61806
|
FETCH_TIMEOUT_MS2
|
|
61521
61807
|
);
|
|
61522
|
-
const sha = (await git2(
|
|
61523
|
-
const branch2 = await switchToSnapshot(
|
|
61524
|
-
await git2(
|
|
61525
|
-
if (snapshot2.upstream) await trackUpstream(
|
|
61808
|
+
const sha = (await git2(path115, ["rev-parse", "FETCH_HEAD"])).trim();
|
|
61809
|
+
const branch2 = await switchToSnapshot(path115, snapshot2, sha);
|
|
61810
|
+
await git2(path115, ["reset", "--soft", "--quiet", "HEAD~1"]);
|
|
61811
|
+
if (snapshot2.upstream) await trackUpstream(path115, snapshot2.upstream);
|
|
61526
61812
|
daemonLog(
|
|
61527
|
-
`transfer restore ${
|
|
61813
|
+
`transfer restore ${path115}: ${snapshot2.ref} restored onto ${branch2}${snapshot2.upstream ? ` tracking origin/${snapshot2.upstream}` : ""}`
|
|
61528
61814
|
);
|
|
61529
61815
|
const deleted = await gitResult(
|
|
61530
|
-
|
|
61816
|
+
path115,
|
|
61531
61817
|
["push", "--no-verify", "--quiet", "origin", "--delete", snapshot2.ref],
|
|
61532
61818
|
FETCH_TIMEOUT_MS2
|
|
61533
61819
|
);
|
|
61534
61820
|
daemonLog(
|
|
61535
|
-
deleted.ok ? `transfer restore ${
|
|
61821
|
+
deleted.ok ? `transfer restore ${path115}: deleted ${snapshot2.ref} from origin` : `transfer restore ${path115}: could not delete ${snapshot2.ref} from origin: ${deleted.error}`
|
|
61536
61822
|
);
|
|
61537
61823
|
}
|
|
61538
61824
|
|
|
@@ -61543,10 +61829,10 @@ async function spawnTransferredRun(ctx, discard, { assistArgs, cwd, meta, snapsh
|
|
|
61543
61829
|
ctx,
|
|
61544
61830
|
cwd,
|
|
61545
61831
|
(sid, resolvedCwd) => createAssistSession(sid, assistArgs, resolvedCwd, meta, true),
|
|
61546
|
-
async (
|
|
61547
|
-
if (!
|
|
61548
|
-
daemonLog(`transfer restore ${
|
|
61549
|
-
await restoreTransferSnapshot(
|
|
61832
|
+
async (path115) => {
|
|
61833
|
+
if (!path115) throw new Error("no working tree to restore into");
|
|
61834
|
+
daemonLog(`transfer restore ${path115}: fetching ${snapshot2.ref} ${trace}`);
|
|
61835
|
+
await restoreTransferSnapshot(path115, snapshot2);
|
|
61550
61836
|
},
|
|
61551
61837
|
{ inPlace: meta.inPlace },
|
|
61552
61838
|
context
|
|
@@ -61635,14 +61921,14 @@ function spawnAssistCreate(m, d) {
|
|
|
61635
61921
|
},
|
|
61636
61922
|
spawnContextFrom(d)
|
|
61637
61923
|
);
|
|
61638
|
-
const
|
|
61924
|
+
const spawn14 = (holder) => m.spawnAssist(
|
|
61639
61925
|
assistArgs,
|
|
61640
61926
|
holder ?? cwd,
|
|
61641
61927
|
{ ...meta, inPlace: inPlace || holder !== void 0 },
|
|
61642
61928
|
spawnContextFrom(d)
|
|
61643
61929
|
);
|
|
61644
|
-
if (inPlace || !isPrCheckoutArgs(assistArgs)) return
|
|
61645
|
-
return prCheckoutHolder(assistArgs, cwd).then(
|
|
61930
|
+
if (inPlace || !isPrCheckoutArgs(assistArgs)) return spawn14();
|
|
61931
|
+
return prCheckoutHolder(assistArgs, cwd).then(spawn14);
|
|
61646
61932
|
}
|
|
61647
61933
|
|
|
61648
61934
|
// src/commands/sessions/daemon/spawnCreate.ts
|
|
@@ -61795,7 +62081,7 @@ function handleConnection(socket, manager) {
|
|
|
61795
62081
|
};
|
|
61796
62082
|
manager.addClient(client);
|
|
61797
62083
|
manager.clients.greet(client);
|
|
61798
|
-
const lines =
|
|
62084
|
+
const lines = createInterface11({ input: socket });
|
|
61799
62085
|
lines.on("error", () => {
|
|
61800
62086
|
});
|
|
61801
62087
|
lines.on("line", (line) => {
|
|
@@ -62266,8 +62552,8 @@ async function awaitLinkReturn(name2, options2, deps2 = {}) {
|
|
|
62266
62552
|
}
|
|
62267
62553
|
|
|
62268
62554
|
// src/commands/sessions/nodes/postToPeer.ts
|
|
62269
|
-
async function postToPeer(baseUrl2,
|
|
62270
|
-
const res = await fetch(new URL(
|
|
62555
|
+
async function postToPeer(baseUrl2, path115, traceId, timeoutMs) {
|
|
62556
|
+
const res = await fetch(new URL(path115, baseUrl2), {
|
|
62271
62557
|
method: "POST",
|
|
62272
62558
|
headers: {
|
|
62273
62559
|
"x-assist-linked-from": resolveNodeName(),
|
|
@@ -62277,7 +62563,7 @@ async function postToPeer(baseUrl2, path114, traceId, timeoutMs) {
|
|
|
62277
62563
|
});
|
|
62278
62564
|
if (res.ok) return;
|
|
62279
62565
|
const body = await res.json().catch(() => ({}));
|
|
62280
|
-
throw new Error(body.error ?? `POST ${
|
|
62566
|
+
throw new Error(body.error ?? `POST ${path115} returned ${res.status}`);
|
|
62281
62567
|
}
|
|
62282
62568
|
|
|
62283
62569
|
// src/commands/sessions/nodes/startPeerAction.ts
|
|
@@ -62446,14 +62732,14 @@ function registerNodes(sessions) {
|
|
|
62446
62732
|
}
|
|
62447
62733
|
|
|
62448
62734
|
// src/commands/sessions/daemon/requestSessionOutput.ts
|
|
62449
|
-
import { createInterface as
|
|
62735
|
+
import { createInterface as createInterface12 } from "readline";
|
|
62450
62736
|
var OUTPUT_TIMEOUT_MS = 5e3;
|
|
62451
62737
|
async function requestSessionOutput(target) {
|
|
62452
62738
|
const socket = await connectToDaemon().catch(() => {
|
|
62453
62739
|
throw new Error("No sessions daemon is running");
|
|
62454
62740
|
});
|
|
62455
62741
|
try {
|
|
62456
|
-
const lines =
|
|
62742
|
+
const lines = createInterface12({ input: socket });
|
|
62457
62743
|
lines.on("error", () => {
|
|
62458
62744
|
});
|
|
62459
62745
|
const reply2 = readDaemonMessage(
|