@staff0rd/assist 0.1121.1 → 0.1121.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/built-version +1 -1
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +833 -777
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.1121.
|
|
9
|
+
version: "0.1121.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 path128 = join2(dir, name2);
|
|
190
190
|
try {
|
|
191
|
-
if (now - statSync(
|
|
192
|
-
rmSync(
|
|
191
|
+
if (now - statSync(path128).mtimeMs > PANE_PERSIST_TTL_MS)
|
|
192
|
+
rmSync(path128, { recursive: true, force: true });
|
|
193
193
|
} catch {
|
|
194
194
|
}
|
|
195
195
|
}
|
|
@@ -1041,9 +1041,9 @@ var assistConfigSchema = z6.strictObject({
|
|
|
1041
1041
|
});
|
|
1042
1042
|
|
|
1043
1043
|
// src/shared/dropUnknownConfigKeys.ts
|
|
1044
|
-
function objectAt(root2,
|
|
1044
|
+
function objectAt(root2, path128) {
|
|
1045
1045
|
let node = root2;
|
|
1046
|
-
for (const segment of
|
|
1046
|
+
for (const segment of path128) {
|
|
1047
1047
|
if (!node || typeof node !== "object") return void 0;
|
|
1048
1048
|
node = node[segment];
|
|
1049
1049
|
}
|
|
@@ -1095,9 +1095,9 @@ function findGitLink(dir) {
|
|
|
1095
1095
|
}
|
|
1096
1096
|
return null;
|
|
1097
1097
|
}
|
|
1098
|
-
function isFile(
|
|
1098
|
+
function isFile(path128) {
|
|
1099
1099
|
try {
|
|
1100
|
-
return statSync3(
|
|
1100
|
+
return statSync3(path128).isFile();
|
|
1101
1101
|
} catch {
|
|
1102
1102
|
return false;
|
|
1103
1103
|
}
|
|
@@ -1116,9 +1116,9 @@ function linkedGitDirParent(gitDir) {
|
|
|
1116
1116
|
const match = /^(.*)[/\\]worktrees[/\\][^/\\]+[/\\]?$/.exec(gitDir);
|
|
1117
1117
|
return match ? match[1] : null;
|
|
1118
1118
|
}
|
|
1119
|
-
function readTrimmed(
|
|
1119
|
+
function readTrimmed(path128) {
|
|
1120
1120
|
try {
|
|
1121
|
-
const content = readFileSync(
|
|
1121
|
+
const content = readFileSync(path128, "utf8").trim();
|
|
1122
1122
|
return content === "" ? null : content;
|
|
1123
1123
|
} catch {
|
|
1124
1124
|
return null;
|
|
@@ -1131,10 +1131,10 @@ function absolute(target, from) {
|
|
|
1131
1131
|
// src/shared/loadRawYaml.ts
|
|
1132
1132
|
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
1133
1133
|
import { parse as parseYaml } from "yaml";
|
|
1134
|
-
function loadRawYaml(
|
|
1135
|
-
if (!existsSync2(
|
|
1134
|
+
function loadRawYaml(path128) {
|
|
1135
|
+
if (!existsSync2(path128)) return {};
|
|
1136
1136
|
try {
|
|
1137
|
-
const content = readFileSync2(
|
|
1137
|
+
const content = readFileSync2(path128, "utf8");
|
|
1138
1138
|
return parseYaml(content) || {};
|
|
1139
1139
|
} catch {
|
|
1140
1140
|
return {};
|
|
@@ -1236,10 +1236,10 @@ function getStorePath(filename) {
|
|
|
1236
1236
|
return join5(getStoreDir(), filename);
|
|
1237
1237
|
}
|
|
1238
1238
|
function loadJson(filename) {
|
|
1239
|
-
const
|
|
1240
|
-
if (existsSync3(
|
|
1239
|
+
const path128 = getStorePath(filename);
|
|
1240
|
+
if (existsSync3(path128)) {
|
|
1241
1241
|
try {
|
|
1242
|
-
return JSON.parse(readFileSync3(
|
|
1242
|
+
return JSON.parse(readFileSync3(path128, "utf8"));
|
|
1243
1243
|
} catch {
|
|
1244
1244
|
return {};
|
|
1245
1245
|
}
|
|
@@ -1251,11 +1251,11 @@ function saveJson(filename, data) {
|
|
|
1251
1251
|
if (!existsSync3(dir)) {
|
|
1252
1252
|
mkdirSync2(dir, { recursive: true });
|
|
1253
1253
|
}
|
|
1254
|
-
const
|
|
1255
|
-
const tmp = `${
|
|
1254
|
+
const path128 = getStorePath(filename);
|
|
1255
|
+
const tmp = `${path128}.${process.pid}.tmp`;
|
|
1256
1256
|
try {
|
|
1257
1257
|
writeFileSync(tmp, JSON.stringify(data, null, 2));
|
|
1258
|
-
renameSync(tmp,
|
|
1258
|
+
renameSync(tmp, path128);
|
|
1259
1259
|
} catch (error) {
|
|
1260
1260
|
rmSync2(tmp, { force: true });
|
|
1261
1261
|
throw error;
|
|
@@ -1267,10 +1267,10 @@ function repoConfigCachePath() {
|
|
|
1267
1267
|
return join6(getStoreDir(), "repo-config-cache.json");
|
|
1268
1268
|
}
|
|
1269
1269
|
function readConfigCacheFile() {
|
|
1270
|
-
const
|
|
1271
|
-
if (!existsSync4(
|
|
1270
|
+
const path128 = repoConfigCachePath();
|
|
1271
|
+
if (!existsSync4(path128)) return {};
|
|
1272
1272
|
try {
|
|
1273
|
-
const parsed = JSON.parse(readFileSync4(
|
|
1273
|
+
const parsed = JSON.parse(readFileSync4(path128, "utf8"));
|
|
1274
1274
|
return parsed ?? {};
|
|
1275
1275
|
} catch {
|
|
1276
1276
|
return {};
|
|
@@ -1337,8 +1337,8 @@ function getRemoteOriginUrl(cwd) {
|
|
|
1337
1337
|
|
|
1338
1338
|
// src/commands/backlog/getCurrentOrigin.ts
|
|
1339
1339
|
var WINDOWS_PATH = /^[A-Za-z]:[\\/]/;
|
|
1340
|
-
function stripLeadingSlashes(
|
|
1341
|
-
return
|
|
1340
|
+
function stripLeadingSlashes(path128) {
|
|
1341
|
+
return path128.replace(/^\/+/, "");
|
|
1342
1342
|
}
|
|
1343
1343
|
function normalizeOrigin(raw) {
|
|
1344
1344
|
const trimmed = raw.trim().replace(/\.git$/i, "").replace(/\/+$/, "");
|
|
@@ -1381,8 +1381,8 @@ function getCachedOrigin(cwd) {
|
|
|
1381
1381
|
// src/commands/backlog/originDisplayName.ts
|
|
1382
1382
|
function originDisplayName(origin) {
|
|
1383
1383
|
if (origin.startsWith("local:")) {
|
|
1384
|
-
const
|
|
1385
|
-
const segments =
|
|
1384
|
+
const path128 = origin.slice("local:".length).replace(/\/+$/, "");
|
|
1385
|
+
const segments = path128.split("/").filter(Boolean);
|
|
1386
1386
|
return segments[segments.length - 1] ?? origin;
|
|
1387
1387
|
}
|
|
1388
1388
|
const firstSlash = origin.indexOf("/");
|
|
@@ -2652,9 +2652,9 @@ var LOCAL_FILES = ["backlog.jsonl", "backlog.db"];
|
|
|
2652
2652
|
function backupLocalBacklogFiles(dir) {
|
|
2653
2653
|
const moved = [];
|
|
2654
2654
|
for (const name2 of LOCAL_FILES) {
|
|
2655
|
-
const
|
|
2656
|
-
if (existsSync9(
|
|
2657
|
-
renameSync2(
|
|
2655
|
+
const path128 = join9(dir, ".assist", name2);
|
|
2656
|
+
if (existsSync9(path128)) {
|
|
2657
|
+
renameSync2(path128, `${path128}.bak`);
|
|
2658
2658
|
moved.push(`${name2} \u2192 ${name2}.bak`);
|
|
2659
2659
|
}
|
|
2660
2660
|
}
|
|
@@ -3105,8 +3105,8 @@ var backlogItemSchema = z7.strictObject({
|
|
|
3105
3105
|
var backlogFileSchema = z7.array(backlogItemSchema);
|
|
3106
3106
|
|
|
3107
3107
|
// src/commands/backlog/parseBacklogJsonl.ts
|
|
3108
|
-
function parseBacklogJsonl(
|
|
3109
|
-
const content = readFileSync5(
|
|
3108
|
+
function parseBacklogJsonl(path128) {
|
|
3109
|
+
const content = readFileSync5(path128, "utf8").trim();
|
|
3110
3110
|
if (content.length === 0) return [];
|
|
3111
3111
|
return content.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => backlogItemSchema.parse(JSON.parse(line)));
|
|
3112
3112
|
}
|
|
@@ -3303,8 +3303,8 @@ async function cleanupFalseResetSegments(db) {
|
|
|
3303
3303
|
}
|
|
3304
3304
|
|
|
3305
3305
|
// src/shared/db/describeDatabaseUrlSource.ts
|
|
3306
|
-
function hasDatabaseUrl(
|
|
3307
|
-
const database = loadRawYaml(
|
|
3306
|
+
function hasDatabaseUrl(path128) {
|
|
3307
|
+
const database = loadRawYaml(path128).database;
|
|
3308
3308
|
return database?.url !== void 0;
|
|
3309
3309
|
}
|
|
3310
3310
|
function describeDatabaseUrlSource(cwd = process.cwd(), globalConfigPath = getGlobalConfigPath()) {
|
|
@@ -4894,10 +4894,10 @@ function completeLines(text18, windowIsPartial) {
|
|
|
4894
4894
|
if (windowIsPartial) all.shift();
|
|
4895
4895
|
return all;
|
|
4896
4896
|
}
|
|
4897
|
-
function readLogTail(
|
|
4897
|
+
function readLogTail(path128, lines) {
|
|
4898
4898
|
let fd;
|
|
4899
4899
|
try {
|
|
4900
|
-
fd = openSync2(
|
|
4900
|
+
fd = openSync2(path128, "r");
|
|
4901
4901
|
} catch {
|
|
4902
4902
|
return [];
|
|
4903
4903
|
}
|
|
@@ -5237,10 +5237,10 @@ var hooksSettings = {
|
|
|
5237
5237
|
}
|
|
5238
5238
|
};
|
|
5239
5239
|
function ensureHooksSettings() {
|
|
5240
|
-
const
|
|
5241
|
-
mkdirSync3(dirname5(
|
|
5242
|
-
writeFileSync3(
|
|
5243
|
-
return
|
|
5240
|
+
const path128 = daemonPaths.hooksSettings;
|
|
5241
|
+
mkdirSync3(dirname5(path128), { recursive: true });
|
|
5242
|
+
writeFileSync3(path128, JSON.stringify(hooksSettings, null, 2));
|
|
5243
|
+
return path128;
|
|
5244
5244
|
}
|
|
5245
5245
|
|
|
5246
5246
|
// src/commands/sessions/daemon/spawnPty.ts
|
|
@@ -6137,12 +6137,12 @@ function claudeToolOperations({
|
|
|
6137
6137
|
return paths.length ? [{ kind: "fileRead", tool: toolName, paths }] : [];
|
|
6138
6138
|
}
|
|
6139
6139
|
if (WRITE_TOOLS.has(toolName)) {
|
|
6140
|
-
const [
|
|
6141
|
-
return
|
|
6140
|
+
const [path128] = strings([toolInput.file_path, toolInput.notebook_path]);
|
|
6141
|
+
return path128 ? [
|
|
6142
6142
|
{
|
|
6143
6143
|
kind: "fileWrite",
|
|
6144
6144
|
tool: toolName,
|
|
6145
|
-
path:
|
|
6145
|
+
path: path128,
|
|
6146
6146
|
contents: incomingContents(toolInput)
|
|
6147
6147
|
}
|
|
6148
6148
|
] : [];
|
|
@@ -7772,13 +7772,13 @@ function record2(value) {
|
|
|
7772
7772
|
return value && typeof value === "object" ? value : {};
|
|
7773
7773
|
}
|
|
7774
7774
|
function fileWrites(changes) {
|
|
7775
|
-
return Object.entries(changes).flatMap(([
|
|
7775
|
+
return Object.entries(changes).flatMap(([path128, change]) => {
|
|
7776
7776
|
const { content, move_path: movePath } = record2(change);
|
|
7777
7777
|
const contents = typeof content === "string" ? [content] : [];
|
|
7778
7778
|
const write2 = {
|
|
7779
7779
|
kind: "fileWrite",
|
|
7780
7780
|
tool: "apply_patch",
|
|
7781
|
-
path:
|
|
7781
|
+
path: path128,
|
|
7782
7782
|
contents
|
|
7783
7783
|
};
|
|
7784
7784
|
return typeof movePath === "string" ? [write2, { ...write2, path: movePath }] : [write2];
|
|
@@ -7885,8 +7885,8 @@ function parseApplyPatch(patch2) {
|
|
|
7885
7885
|
}
|
|
7886
7886
|
if (added && line.startsWith("+")) added.push(line.slice(1));
|
|
7887
7887
|
}
|
|
7888
|
-
return files.map(({ path:
|
|
7889
|
-
path:
|
|
7888
|
+
return files.map(({ path: path128, added: lines }) => ({
|
|
7889
|
+
path: path128,
|
|
7890
7890
|
contents: lines.length ? [lines.join("\n")] : []
|
|
7891
7891
|
}));
|
|
7892
7892
|
}
|
|
@@ -7907,10 +7907,10 @@ function patchText(input) {
|
|
|
7907
7907
|
);
|
|
7908
7908
|
}
|
|
7909
7909
|
function patchWrites(tool, patch2) {
|
|
7910
|
-
return parseApplyPatch(patch2).map(({ path:
|
|
7910
|
+
return parseApplyPatch(patch2).map(({ path: path128, contents }) => ({
|
|
7911
7911
|
kind: "fileWrite",
|
|
7912
7912
|
tool,
|
|
7913
|
-
path:
|
|
7913
|
+
path: path128,
|
|
7914
7914
|
contents
|
|
7915
7915
|
}));
|
|
7916
7916
|
}
|
|
@@ -7929,10 +7929,10 @@ function codexToolOperations({
|
|
|
7929
7929
|
if (!PATCH_TOOLS.has(toolName)) return [];
|
|
7930
7930
|
const patch2 = patchText(toolInput);
|
|
7931
7931
|
if (patch2) return patchWrites(toolName, patch2);
|
|
7932
|
-
const { file_path:
|
|
7933
|
-
if (typeof
|
|
7932
|
+
const { file_path: path128, content } = toolInput;
|
|
7933
|
+
if (typeof path128 !== "string") return [];
|
|
7934
7934
|
const contents = typeof content === "string" ? [content] : [];
|
|
7935
|
-
return [{ kind: "fileWrite", tool: toolName, path:
|
|
7935
|
+
return [{ kind: "fileWrite", tool: toolName, path: path128, contents }];
|
|
7936
7936
|
}
|
|
7937
7937
|
|
|
7938
7938
|
// src/shared/harnessAdapters/codexToolEvents.ts
|
|
@@ -8069,8 +8069,8 @@ var codexConversationReader = {
|
|
|
8069
8069
|
headBytes: 2 * 1024 * 1024,
|
|
8070
8070
|
locate: ({ harnessSessionId }) => harnessSessionId ? findCodexRolloutPathSync(harnessSessionId) : null,
|
|
8071
8071
|
watchTarget: (ref) => {
|
|
8072
|
-
const
|
|
8073
|
-
return
|
|
8072
|
+
const path128 = codexConversationReader.locate(ref);
|
|
8073
|
+
return path128 ? { dir: dirname8(path128), file: basename6(path128) } : null;
|
|
8074
8074
|
},
|
|
8075
8075
|
events: (entries) => entries.flatMap(entryEvents),
|
|
8076
8076
|
lifecycle: (entries) => ({
|
|
@@ -8745,15 +8745,15 @@ function piToolOperations({
|
|
|
8745
8745
|
const command = stringField(toolInput, "command")?.trim();
|
|
8746
8746
|
return command ? [{ kind: "command", tool: commandTool, command }] : [];
|
|
8747
8747
|
}
|
|
8748
|
-
const
|
|
8748
|
+
const path128 = stringField(toolInput, "path", "file_path", "pattern");
|
|
8749
8749
|
if (READ_TOOLS2.has(name2))
|
|
8750
|
-
return
|
|
8751
|
-
if (WRITE_TOOLS2.has(name2) &&
|
|
8750
|
+
return path128 ? [{ kind: "fileRead", tool: toolName, paths: [path128] }] : [];
|
|
8751
|
+
if (WRITE_TOOLS2.has(name2) && path128)
|
|
8752
8752
|
return [
|
|
8753
8753
|
{
|
|
8754
8754
|
kind: "fileWrite",
|
|
8755
8755
|
tool: toolName,
|
|
8756
|
-
path:
|
|
8756
|
+
path: path128,
|
|
8757
8757
|
contents: incomingContents2(toolInput)
|
|
8758
8758
|
}
|
|
8759
8759
|
];
|
|
@@ -8921,8 +8921,8 @@ async function loadCommittedPaths(cwd, session) {
|
|
|
8921
8921
|
for (const commit2 of commits2) {
|
|
8922
8922
|
const resolved = await resolveCommit(cwd, commit2.sha);
|
|
8923
8923
|
if (!resolved) continue;
|
|
8924
|
-
for (const
|
|
8925
|
-
if (!bases.has(
|
|
8924
|
+
for (const path128 of resolved.paths) {
|
|
8925
|
+
if (!bases.has(path128)) bases.set(path128, resolved.base);
|
|
8926
8926
|
}
|
|
8927
8927
|
}
|
|
8928
8928
|
return { commits: commits2, bases };
|
|
@@ -8968,16 +8968,16 @@ async function itemChangeSet(cwd, session) {
|
|
|
8968
8968
|
}
|
|
8969
8969
|
function groupByBase(bases) {
|
|
8970
8970
|
const groups = /* @__PURE__ */ new Map();
|
|
8971
|
-
for (const [
|
|
8971
|
+
for (const [path128, base] of bases) {
|
|
8972
8972
|
const paths = groups.get(base);
|
|
8973
|
-
if (paths) paths.push(
|
|
8974
|
-
else groups.set(base, [
|
|
8973
|
+
if (paths) paths.push(path128);
|
|
8974
|
+
else groups.set(base, [path128]);
|
|
8975
8975
|
}
|
|
8976
8976
|
return [...groups].map(([base, paths]) => ({ base, paths: paths.sort() }));
|
|
8977
8977
|
}
|
|
8978
8978
|
async function dirtyPaths(cwd, bases) {
|
|
8979
8979
|
const output = await execGit(cwd, ["diff", "--name-only", "HEAD"]);
|
|
8980
|
-
return output.split("\n").filter((
|
|
8980
|
+
return output.split("\n").filter((path128) => path128 && !bases.has(path128)).sort();
|
|
8981
8981
|
}
|
|
8982
8982
|
|
|
8983
8983
|
// src/commands/sessions/web/scopedDiff.ts
|
|
@@ -8986,8 +8986,8 @@ async function scopedDiff(cwd, session, scope) {
|
|
|
8986
8986
|
if (scope.kind === "commit") return commitDiff(cwd, scope.sha);
|
|
8987
8987
|
return await trackedScopeDiff(cwd, session, scope) + await untrackedDiff(cwd);
|
|
8988
8988
|
}
|
|
8989
|
-
async function untrackedFileDiff(cwd,
|
|
8990
|
-
return execGit(cwd, ["diff", "--no-index", "--", "/dev/null",
|
|
8989
|
+
async function untrackedFileDiff(cwd, path128) {
|
|
8990
|
+
return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path128], {
|
|
8991
8991
|
maxBuffer: MAX_DIFF_BYTES,
|
|
8992
8992
|
allowFailure: true
|
|
8993
8993
|
});
|
|
@@ -9000,7 +9000,7 @@ async function untrackedDiff(cwd) {
|
|
|
9000
9000
|
]);
|
|
9001
9001
|
const paths = list7.split("\n").filter(Boolean);
|
|
9002
9002
|
const diffs = await Promise.all(
|
|
9003
|
-
paths.map((
|
|
9003
|
+
paths.map((path128) => untrackedFileDiff(cwd, path128))
|
|
9004
9004
|
);
|
|
9005
9005
|
return diffs.join("");
|
|
9006
9006
|
}
|
|
@@ -9209,8 +9209,8 @@ import { readFile, stat } from "fs/promises";
|
|
|
9209
9209
|
// src/commands/sessions/web/fileContent/respondCommitFile.ts
|
|
9210
9210
|
import { relative, sep } from "path";
|
|
9211
9211
|
var MAX_FILE_BYTES = 2 * 1024 * 1024;
|
|
9212
|
-
async function commitBlob(cwd, sha,
|
|
9213
|
-
const line = await execGit(cwd, ["ls-tree", "-l", sha, "--",
|
|
9212
|
+
async function commitBlob(cwd, sha, path128) {
|
|
9213
|
+
const line = await execGit(cwd, ["ls-tree", "-l", sha, "--", path128]);
|
|
9214
9214
|
const match = /^\d+ blob ([0-9a-f]+)\s+(\d+)\t/.exec(line);
|
|
9215
9215
|
if (!match) return void 0;
|
|
9216
9216
|
return { hash: match[1], size: Number(match[2]) };
|
|
@@ -9226,8 +9226,8 @@ async function respondCommitFile(req, res, { cwd, target }, commit2) {
|
|
|
9226
9226
|
respondJson(res, 400, { error: "Invalid commit" });
|
|
9227
9227
|
return;
|
|
9228
9228
|
}
|
|
9229
|
-
const
|
|
9230
|
-
const blob = await commitBlob(cwd, scope.sha,
|
|
9229
|
+
const path128 = relative(cwd, target).split(sep).join("/");
|
|
9230
|
+
const blob = await commitBlob(cwd, scope.sha, path128);
|
|
9231
9231
|
if (!blob) {
|
|
9232
9232
|
respondJson(res, 404, { error: "File not found" });
|
|
9233
9233
|
return;
|
|
@@ -9250,9 +9250,9 @@ import { isAbsolute as isAbsolute2, relative as relative2, resolve as resolve4 }
|
|
|
9250
9250
|
function repoRoot2(cwd) {
|
|
9251
9251
|
return resolve4(cwd);
|
|
9252
9252
|
}
|
|
9253
|
-
function resolveWithinCwd(cwd,
|
|
9253
|
+
function resolveWithinCwd(cwd, path128) {
|
|
9254
9254
|
const root2 = repoRoot2(cwd);
|
|
9255
|
-
const target = resolve4(root2,
|
|
9255
|
+
const target = resolve4(root2, path128);
|
|
9256
9256
|
const rel = relative2(root2, target);
|
|
9257
9257
|
if (rel === "" || rel.startsWith("..") || isAbsolute2(rel)) return null;
|
|
9258
9258
|
return target;
|
|
@@ -9262,14 +9262,14 @@ function resolveWithinCwd(cwd, path126) {
|
|
|
9262
9262
|
function getFileTarget(req, res) {
|
|
9263
9263
|
const cwd = getCwdParam(req, res);
|
|
9264
9264
|
if (!cwd) return null;
|
|
9265
|
-
const
|
|
9265
|
+
const path128 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
|
|
9266
9266
|
"path"
|
|
9267
9267
|
);
|
|
9268
|
-
if (!
|
|
9268
|
+
if (!path128) {
|
|
9269
9269
|
respondJson(res, 400, { error: "Missing path" });
|
|
9270
9270
|
return null;
|
|
9271
9271
|
}
|
|
9272
|
-
const target = resolveWithinCwd(cwd,
|
|
9272
|
+
const target = resolveWithinCwd(cwd, path128);
|
|
9273
9273
|
if (!target) {
|
|
9274
9274
|
respondJson(res, 400, { error: "Path outside cwd" });
|
|
9275
9275
|
return null;
|
|
@@ -9844,9 +9844,9 @@ function segmentText(segment) {
|
|
|
9844
9844
|
if (segment.kind === "index") return `[${segment.index}]`;
|
|
9845
9845
|
return "[]";
|
|
9846
9846
|
}
|
|
9847
|
-
function formatConfigPath(
|
|
9847
|
+
function formatConfigPath(path128) {
|
|
9848
9848
|
let text18 = "";
|
|
9849
|
-
for (const segment of
|
|
9849
|
+
for (const segment of path128) {
|
|
9850
9850
|
const dotted = segment.kind === "key" || segment.kind === "entry";
|
|
9851
9851
|
const rendered = segmentText(segment);
|
|
9852
9852
|
text18 += dotted && text18 ? `.${rendered}` : rendered;
|
|
@@ -10017,11 +10017,11 @@ function enumValues(node) {
|
|
|
10017
10017
|
function opaqueConfigNode(inner, base) {
|
|
10018
10018
|
return { ...base, kind: "other", type: leafTypeOf(inner) };
|
|
10019
10019
|
}
|
|
10020
|
-
function build(node,
|
|
10020
|
+
function build(node, path128) {
|
|
10021
10021
|
const { inner, defaultValue, optional } = unwrapSchemaNode(node);
|
|
10022
10022
|
const secret = isSecretSchemaNode(node) || isSecretSchemaNode(inner);
|
|
10023
10023
|
const base = {
|
|
10024
|
-
path:
|
|
10024
|
+
path: path128,
|
|
10025
10025
|
...optional ? { optional: true } : {},
|
|
10026
10026
|
...defaultValue === void 0 ? {} : { defaultValue },
|
|
10027
10027
|
...secret ? { secret: true } : {}
|
|
@@ -10077,11 +10077,11 @@ function describeConfigLeaves(schema2) {
|
|
|
10077
10077
|
|
|
10078
10078
|
// src/commands/config/globalConfigFileLabel.ts
|
|
10079
10079
|
var WINDOWS_MOUNT_PREFIX = "/mnt/";
|
|
10080
|
-
function globalConfigFileLabel(
|
|
10081
|
-
if (
|
|
10082
|
-
if (
|
|
10083
|
-
return `${
|
|
10084
|
-
return
|
|
10080
|
+
function globalConfigFileLabel(path128) {
|
|
10081
|
+
if (path128 === getGlobalConfigPath()) return "~/.assist.yml";
|
|
10082
|
+
if (path128.startsWith(WINDOWS_MOUNT_PREFIX))
|
|
10083
|
+
return `${path128} on the Windows host`;
|
|
10084
|
+
return path128;
|
|
10085
10085
|
}
|
|
10086
10086
|
|
|
10087
10087
|
// src/shared/readUserConfigCache.ts
|
|
@@ -10139,35 +10139,35 @@ function isPlainRecord(value) {
|
|
|
10139
10139
|
}
|
|
10140
10140
|
|
|
10141
10141
|
// src/shared/mapConfigSecrets.ts
|
|
10142
|
-
function mapChildren(value,
|
|
10142
|
+
function mapChildren(value, path128, childNode, map) {
|
|
10143
10143
|
if (!isPlainRecord(value)) return value;
|
|
10144
10144
|
return Object.fromEntries(
|
|
10145
10145
|
Object.entries(value).map(([name2, child2]) => [
|
|
10146
10146
|
name2,
|
|
10147
|
-
walk(child2, [...
|
|
10147
|
+
walk(child2, [...path128, name2], childNode(name2), map)
|
|
10148
10148
|
])
|
|
10149
10149
|
);
|
|
10150
10150
|
}
|
|
10151
|
-
function mapItems(value,
|
|
10151
|
+
function mapItems(value, path128, item, map) {
|
|
10152
10152
|
if (!Array.isArray(value)) return value;
|
|
10153
|
-
return value.map((entry, index3) => walk(entry, [...
|
|
10153
|
+
return value.map((entry, index3) => walk(entry, [...path128, index3], item, map));
|
|
10154
10154
|
}
|
|
10155
|
-
function walk(value,
|
|
10155
|
+
function walk(value, path128, node, map) {
|
|
10156
10156
|
if (!node || value === void 0 || value === null) return value;
|
|
10157
|
-
if (node.secret) return map(value,
|
|
10157
|
+
if (node.secret) return map(value, path128);
|
|
10158
10158
|
switch (node.kind) {
|
|
10159
10159
|
case "object":
|
|
10160
10160
|
case "unionOfObjects":
|
|
10161
10161
|
return mapChildren(
|
|
10162
10162
|
value,
|
|
10163
|
-
|
|
10163
|
+
path128,
|
|
10164
10164
|
(name2) => configNodeField(node, name2),
|
|
10165
10165
|
map
|
|
10166
10166
|
);
|
|
10167
10167
|
case "objectList":
|
|
10168
|
-
return mapItems(value,
|
|
10168
|
+
return mapItems(value, path128, node.item, map);
|
|
10169
10169
|
case "record":
|
|
10170
|
-
return mapChildren(value,
|
|
10170
|
+
return mapChildren(value, path128, () => node.value, map);
|
|
10171
10171
|
default:
|
|
10172
10172
|
return value;
|
|
10173
10173
|
}
|
|
@@ -10192,9 +10192,9 @@ function isTraversable(value) {
|
|
|
10192
10192
|
function stepInto(current2, key) {
|
|
10193
10193
|
return isTraversable(current2) ? current2[key] : void 0;
|
|
10194
10194
|
}
|
|
10195
|
-
function getNestedValue(obj,
|
|
10195
|
+
function getNestedValue(obj, path128) {
|
|
10196
10196
|
let current2 = obj;
|
|
10197
|
-
for (const key of
|
|
10197
|
+
for (const key of path128.split(".")) current2 = stepInto(current2, key);
|
|
10198
10198
|
return current2;
|
|
10199
10199
|
}
|
|
10200
10200
|
|
|
@@ -10245,9 +10245,9 @@ function step(node, segment) {
|
|
|
10245
10245
|
return void 0;
|
|
10246
10246
|
}
|
|
10247
10247
|
}
|
|
10248
|
-
function findConfigNode(root2,
|
|
10248
|
+
function findConfigNode(root2, path128) {
|
|
10249
10249
|
let current2 = root2;
|
|
10250
|
-
for (const segment of
|
|
10250
|
+
for (const segment of path128) {
|
|
10251
10251
|
if (!current2) return void 0;
|
|
10252
10252
|
current2 = step(current2, segment);
|
|
10253
10253
|
}
|
|
@@ -10264,34 +10264,34 @@ function nameSegment(name2) {
|
|
|
10264
10264
|
return name2 === RECORD_ENTRY_TOKEN ? { kind: "entry" } : { kind: "key", name: name2 };
|
|
10265
10265
|
}
|
|
10266
10266
|
function parseConfigPath(text18) {
|
|
10267
|
-
const
|
|
10267
|
+
const path128 = [];
|
|
10268
10268
|
let at2 = 0;
|
|
10269
10269
|
while (at2 < text18.length) {
|
|
10270
10270
|
if (text18[at2] === "[") {
|
|
10271
10271
|
const close = text18.indexOf("]", at2);
|
|
10272
10272
|
const segment = close === -1 ? void 0 : bracketSegment(text18.slice(at2 + 1, close));
|
|
10273
10273
|
if (!segment) return void 0;
|
|
10274
|
-
|
|
10274
|
+
path128.push(segment);
|
|
10275
10275
|
at2 = close + 1;
|
|
10276
10276
|
continue;
|
|
10277
10277
|
}
|
|
10278
10278
|
if (text18[at2] === ".") {
|
|
10279
|
-
if (
|
|
10279
|
+
if (path128.length === 0) return void 0;
|
|
10280
10280
|
at2 += 1;
|
|
10281
10281
|
}
|
|
10282
10282
|
const start2 = at2;
|
|
10283
10283
|
while (at2 < text18.length && text18[at2] !== "." && text18[at2] !== "[") at2 += 1;
|
|
10284
10284
|
const name2 = text18.slice(start2, at2);
|
|
10285
10285
|
if (!name2) return void 0;
|
|
10286
|
-
|
|
10286
|
+
path128.push(nameSegment(name2));
|
|
10287
10287
|
}
|
|
10288
|
-
return
|
|
10288
|
+
return path128;
|
|
10289
10289
|
}
|
|
10290
10290
|
|
|
10291
10291
|
// src/commands/config/configEntryNode.ts
|
|
10292
10292
|
function configEntryNode(root2, key) {
|
|
10293
|
-
const
|
|
10294
|
-
return
|
|
10293
|
+
const path128 = parseConfigPath(key);
|
|
10294
|
+
return path128 ? findConfigNode(root2, path128) : void 0;
|
|
10295
10295
|
}
|
|
10296
10296
|
|
|
10297
10297
|
// src/commands/advise/adviceConfigHelp.ts
|
|
@@ -11261,8 +11261,8 @@ function stepIntoNested(container, key, nextKey) {
|
|
|
11261
11261
|
}
|
|
11262
11262
|
return ensureObject(container, resolved);
|
|
11263
11263
|
}
|
|
11264
|
-
function setNestedValue(obj,
|
|
11265
|
-
const keys =
|
|
11264
|
+
function setNestedValue(obj, path128, value) {
|
|
11265
|
+
const keys = path128.split(".");
|
|
11266
11266
|
const result = { ...obj };
|
|
11267
11267
|
let current2 = result;
|
|
11268
11268
|
for (let i = 0; i < keys.length - 1; i++) {
|
|
@@ -11497,7 +11497,7 @@ function findSynthesisForBranch(repoReviewsDir, branch2) {
|
|
|
11497
11497
|
const parent = dirname11(branchKeyPath);
|
|
11498
11498
|
const branchPrefix = basename9(branchKeyPath);
|
|
11499
11499
|
if (!existsSync25(parent)) return null;
|
|
11500
|
-
const synthesisFiles = readdirSync9(parent).filter((name2) => name2.startsWith(branchPrefix)).map((name2) => join31(parent, name2, "synthesis.md")).filter((
|
|
11500
|
+
const synthesisFiles = readdirSync9(parent).filter((name2) => name2.startsWith(branchPrefix)).map((name2) => join31(parent, name2, "synthesis.md")).filter((path128) => existsSync25(path128)).map((path128) => ({ path: path128, mtime: statSync8(path128).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
|
|
11501
11501
|
return synthesisFiles[0]?.path ?? null;
|
|
11502
11502
|
}
|
|
11503
11503
|
|
|
@@ -11527,12 +11527,12 @@ async function getReviewSynthesis(req, res) {
|
|
|
11527
11527
|
const cwd = getCwdParam(req, res);
|
|
11528
11528
|
if (!cwd) return;
|
|
11529
11529
|
try {
|
|
11530
|
-
const
|
|
11531
|
-
if (!
|
|
11530
|
+
const path128 = await resolveSynthesisPath(cwd);
|
|
11531
|
+
if (!path128) {
|
|
11532
11532
|
respondJson(res, 404, { error: "No synthesis found" });
|
|
11533
11533
|
return;
|
|
11534
11534
|
}
|
|
11535
|
-
respondJson(res, 200, { synthesis: readFileSync13(
|
|
11535
|
+
respondJson(res, 200, { synthesis: readFileSync13(path128, "utf8") });
|
|
11536
11536
|
} catch {
|
|
11537
11537
|
respondJson(res, 404, { error: "No synthesis found" });
|
|
11538
11538
|
}
|
|
@@ -11554,19 +11554,19 @@ var execFileAsync7 = promisify7(execFile7);
|
|
|
11554
11554
|
var MAX_FILE_BYTES2 = 2 * 1024 * 1024;
|
|
11555
11555
|
var REPO = /^[\w.-]+\/[\w.-]+$/;
|
|
11556
11556
|
var SHA = /^[0-9a-f]{7,40}$/i;
|
|
11557
|
-
function validPath(
|
|
11558
|
-
return
|
|
11557
|
+
function validPath(path128) {
|
|
11558
|
+
return path128.length > 0 && !path128.startsWith("/") && path128.split("/").every((part) => part !== "" && part !== "..");
|
|
11559
11559
|
}
|
|
11560
11560
|
async function githubFileContent(req, res) {
|
|
11561
11561
|
const params = new URL(req.url ?? "/", "http://localhost").searchParams;
|
|
11562
11562
|
const repo = params.get("repo") ?? "";
|
|
11563
11563
|
const sha = params.get("sha") ?? "";
|
|
11564
|
-
const
|
|
11565
|
-
if (!REPO.test(repo) || !SHA.test(sha) || !validPath(
|
|
11564
|
+
const path128 = params.get("path") ?? "";
|
|
11565
|
+
if (!REPO.test(repo) || !SHA.test(sha) || !validPath(path128)) {
|
|
11566
11566
|
respondJson(res, 400, { error: "Invalid repo, sha or path" });
|
|
11567
11567
|
return;
|
|
11568
11568
|
}
|
|
11569
|
-
const encodedPath =
|
|
11569
|
+
const encodedPath = path128.split("/").map(encodeURIComponent).join("/");
|
|
11570
11570
|
try {
|
|
11571
11571
|
const { stdout } = await execFileAsync7(
|
|
11572
11572
|
"gh",
|
|
@@ -11733,8 +11733,8 @@ function parseDiffNameStatus(output) {
|
|
|
11733
11733
|
if (!status2 || fields.length < 2) continue;
|
|
11734
11734
|
const category = categorize(status2[0]);
|
|
11735
11735
|
if (!category) continue;
|
|
11736
|
-
const
|
|
11737
|
-
if (
|
|
11736
|
+
const path128 = fields[fields.length - 1];
|
|
11737
|
+
if (path128) result[category].push(path128);
|
|
11738
11738
|
}
|
|
11739
11739
|
return result;
|
|
11740
11740
|
}
|
|
@@ -12140,24 +12140,24 @@ function getOwnerPath(itemId2) {
|
|
|
12140
12140
|
function recordSignalOwner(itemId2) {
|
|
12141
12141
|
const sessionId2 = process.env.ASSIST_SESSION_ID;
|
|
12142
12142
|
if (!sessionId2) return;
|
|
12143
|
-
const
|
|
12144
|
-
mkdirSync8(dirname12(
|
|
12145
|
-
writeFileSync7(
|
|
12143
|
+
const path128 = getOwnerPath(itemId2);
|
|
12144
|
+
mkdirSync8(dirname12(path128), { recursive: true });
|
|
12145
|
+
writeFileSync7(path128, JSON.stringify({ sessionId: sessionId2 }));
|
|
12146
12146
|
}
|
|
12147
12147
|
function readSignalOwner(itemId2) {
|
|
12148
|
-
const
|
|
12149
|
-
if (!existsSync26(
|
|
12148
|
+
const path128 = getOwnerPath(itemId2);
|
|
12149
|
+
if (!existsSync26(path128)) return void 0;
|
|
12150
12150
|
try {
|
|
12151
|
-
const parsed = JSON.parse(readFileSync14(
|
|
12151
|
+
const parsed = JSON.parse(readFileSync14(path128, "utf8"));
|
|
12152
12152
|
return parsed.sessionId;
|
|
12153
12153
|
} catch {
|
|
12154
12154
|
return void 0;
|
|
12155
12155
|
}
|
|
12156
12156
|
}
|
|
12157
12157
|
function clearSignalOwner(itemId2) {
|
|
12158
|
-
const
|
|
12158
|
+
const path128 = getOwnerPath(itemId2);
|
|
12159
12159
|
try {
|
|
12160
|
-
rmSync3(
|
|
12160
|
+
rmSync3(path128);
|
|
12161
12161
|
} catch {
|
|
12162
12162
|
}
|
|
12163
12163
|
}
|
|
@@ -12194,11 +12194,11 @@ function resolveSignalTarget(event, data) {
|
|
|
12194
12194
|
function writeSignal(event, data) {
|
|
12195
12195
|
const target = resolveSignalTarget(event, data);
|
|
12196
12196
|
if (!target) return;
|
|
12197
|
-
const
|
|
12198
|
-
if (!
|
|
12197
|
+
const path128 = getSignalPath(target);
|
|
12198
|
+
if (!path128) return;
|
|
12199
12199
|
const signal = { event, sessionId: target, ...data };
|
|
12200
|
-
mkdirSync9(dirname13(
|
|
12201
|
-
writeFileSync8(
|
|
12200
|
+
mkdirSync9(dirname13(path128), { recursive: true });
|
|
12201
|
+
writeFileSync8(path128, JSON.stringify(signal));
|
|
12202
12202
|
}
|
|
12203
12203
|
|
|
12204
12204
|
// src/commands/backlog/rewindItemToPhase.ts
|
|
@@ -12626,11 +12626,11 @@ function logLinkedRequest(req, res) {
|
|
|
12626
12626
|
const started2 = Date.now();
|
|
12627
12627
|
const from = req.headers[LINKED_FROM_HEADER2];
|
|
12628
12628
|
const trace = req.headers[TRACE_HEADER] ?? "none";
|
|
12629
|
-
const
|
|
12629
|
+
const path128 = new URL(req.url ?? "/", "http://localhost").pathname;
|
|
12630
12630
|
res.once("finish", () => {
|
|
12631
|
-
if (isQuietPoll(
|
|
12631
|
+
if (isQuietPoll(path128, res.statusCode)) return;
|
|
12632
12632
|
console.log(
|
|
12633
|
-
`link-from ${from} http: ${req.method} ${
|
|
12633
|
+
`link-from ${from} http: ${req.method} ${path128} trace=${trace} -> ${res.statusCode} (${Date.now() - started2}ms)`
|
|
12634
12634
|
);
|
|
12635
12635
|
});
|
|
12636
12636
|
}
|
|
@@ -13204,21 +13204,21 @@ function subsequenceScore(text18, query) {
|
|
|
13204
13204
|
}
|
|
13205
13205
|
return score - Math.min(text18.length, MAX_LENGTH_PENALTY);
|
|
13206
13206
|
}
|
|
13207
|
-
function scoreFilePath(
|
|
13207
|
+
function scoreFilePath(path128, query) {
|
|
13208
13208
|
const needle = query.trim().toLowerCase();
|
|
13209
13209
|
if (!needle) return 0;
|
|
13210
|
-
const basename38 =
|
|
13210
|
+
const basename38 = path128.slice(path128.lastIndexOf("/") + 1);
|
|
13211
13211
|
const inBasename = subsequenceScore(basename38, needle);
|
|
13212
13212
|
if (inBasename !== null) return BASENAME_WEIGHT + inBasename;
|
|
13213
|
-
return subsequenceScore(
|
|
13213
|
+
return subsequenceScore(path128, needle);
|
|
13214
13214
|
}
|
|
13215
13215
|
|
|
13216
13216
|
// src/commands/sessions/web/rankFilePaths.ts
|
|
13217
13217
|
function rankFilePaths(paths, query, limit) {
|
|
13218
13218
|
const scored = [];
|
|
13219
|
-
for (const
|
|
13220
|
-
const score = scoreFilePath(
|
|
13221
|
-
if (score !== null) scored.push({ path:
|
|
13219
|
+
for (const path128 of paths) {
|
|
13220
|
+
const score = scoreFilePath(path128, query);
|
|
13221
|
+
if (score !== null) scored.push({ path: path128, score });
|
|
13222
13222
|
}
|
|
13223
13223
|
scored.sort((a, b) => b.score - a.score || a.path.localeCompare(b.path));
|
|
13224
13224
|
return scored.slice(0, limit).map((entry) => entry.path);
|
|
@@ -14801,8 +14801,8 @@ import { stat as stat2 } from "fs/promises";
|
|
|
14801
14801
|
|
|
14802
14802
|
// src/shared/isStagedAttachmentPath.ts
|
|
14803
14803
|
import { isAbsolute as isAbsolute3, relative as relative4, resolve as resolve9, sep as sep2 } from "path";
|
|
14804
|
-
function isStagedAttachmentPath(
|
|
14805
|
-
const rel = relative4(stagedAttachmentsDir, resolve9(
|
|
14804
|
+
function isStagedAttachmentPath(path128) {
|
|
14805
|
+
const rel = relative4(stagedAttachmentsDir, resolve9(path128));
|
|
14806
14806
|
return rel !== "" && rel !== ".." && !rel.startsWith(`..${sep2}`) && !isAbsolute3(rel);
|
|
14807
14807
|
}
|
|
14808
14808
|
|
|
@@ -14822,8 +14822,8 @@ var attachmentMimeTypes = {
|
|
|
14822
14822
|
};
|
|
14823
14823
|
|
|
14824
14824
|
// src/commands/sessions/web/attachmentContentType.ts
|
|
14825
|
-
function attachmentContentType(
|
|
14826
|
-
const ext = extname(
|
|
14825
|
+
function attachmentContentType(path128) {
|
|
14826
|
+
const ext = extname(path128).replace(/^\./, "").toLowerCase();
|
|
14827
14827
|
const match = Object.entries(attachmentMimeTypes).find(([, e]) => e === ext);
|
|
14828
14828
|
return match?.[0] ?? "application/octet-stream";
|
|
14829
14829
|
}
|
|
@@ -14831,22 +14831,22 @@ function attachmentContentType(path126) {
|
|
|
14831
14831
|
// src/commands/sessions/web/previewImage.ts
|
|
14832
14832
|
async function previewImage(req, res) {
|
|
14833
14833
|
const url = new URL(req.url ?? "/", "http://localhost");
|
|
14834
|
-
const
|
|
14835
|
-
if (!isStagedAttachmentPath(
|
|
14834
|
+
const path128 = url.searchParams.get("path") ?? "";
|
|
14835
|
+
if (!isStagedAttachmentPath(path128)) {
|
|
14836
14836
|
respondJson(res, 400, { error: "Not a staged attachment." });
|
|
14837
14837
|
return;
|
|
14838
14838
|
}
|
|
14839
|
-
const info = await stat2(
|
|
14839
|
+
const info = await stat2(path128).catch(() => null);
|
|
14840
14840
|
if (!info?.isFile()) {
|
|
14841
14841
|
respondJson(res, 404, { error: "Attachment is no longer staged." });
|
|
14842
14842
|
return;
|
|
14843
14843
|
}
|
|
14844
14844
|
res.writeHead(200, {
|
|
14845
|
-
"Content-Type": attachmentContentType(
|
|
14845
|
+
"Content-Type": attachmentContentType(path128),
|
|
14846
14846
|
"Content-Length": info.size,
|
|
14847
14847
|
"Cache-Control": "no-store"
|
|
14848
14848
|
});
|
|
14849
|
-
createReadStream2(
|
|
14849
|
+
createReadStream2(path128).pipe(res);
|
|
14850
14850
|
}
|
|
14851
14851
|
|
|
14852
14852
|
// src/commands/sessions/web/getCurrentBranch.ts
|
|
@@ -15283,8 +15283,8 @@ async function liveDeployments(cwd, repo, environments) {
|
|
|
15283
15283
|
|
|
15284
15284
|
// src/commands/sessions/web/releases/latestRun.ts
|
|
15285
15285
|
async function latestRun(cwd, repo, workflow) {
|
|
15286
|
-
const
|
|
15287
|
-
const response = await ghJson(cwd, ["api",
|
|
15286
|
+
const path128 = `repos/${repo}/actions/workflows/${encodeURIComponent(workflow)}/runs?per_page=1&exclude_pull_requests=true`;
|
|
15287
|
+
const response = await ghJson(cwd, ["api", path128]);
|
|
15288
15288
|
const run5 = response.workflow_runs?.[0];
|
|
15289
15289
|
if (!run5) return null;
|
|
15290
15290
|
return {
|
|
@@ -15579,36 +15579,36 @@ import { relative as relative5 } from "path";
|
|
|
15579
15579
|
function git(cwd, args) {
|
|
15580
15580
|
return execGit(cwd, ["--literal-pathspecs", ...args]);
|
|
15581
15581
|
}
|
|
15582
|
-
async function isTracked(cwd,
|
|
15582
|
+
async function isTracked(cwd, path128) {
|
|
15583
15583
|
try {
|
|
15584
|
-
await git(cwd, ["ls-files", "--error-unmatch", "--",
|
|
15584
|
+
await git(cwd, ["ls-files", "--error-unmatch", "--", path128]);
|
|
15585
15585
|
return true;
|
|
15586
15586
|
} catch {
|
|
15587
15587
|
return false;
|
|
15588
15588
|
}
|
|
15589
15589
|
}
|
|
15590
|
-
async function isInHead(cwd,
|
|
15591
|
-
const listing = await git(cwd, ["ls-tree", "HEAD", "--",
|
|
15590
|
+
async function isInHead(cwd, path128) {
|
|
15591
|
+
const listing = await git(cwd, ["ls-tree", "HEAD", "--", path128]);
|
|
15592
15592
|
return listing.trim().length > 0;
|
|
15593
15593
|
}
|
|
15594
|
-
async function hasChanges(cwd,
|
|
15594
|
+
async function hasChanges(cwd, path128) {
|
|
15595
15595
|
const status2 = await git(cwd, [
|
|
15596
15596
|
"status",
|
|
15597
15597
|
"--porcelain",
|
|
15598
15598
|
"-z",
|
|
15599
15599
|
"--untracked-files=all",
|
|
15600
15600
|
"--",
|
|
15601
|
-
|
|
15601
|
+
path128
|
|
15602
15602
|
]);
|
|
15603
15603
|
return status2.length > 0;
|
|
15604
15604
|
}
|
|
15605
|
-
async function renameSources(cwd,
|
|
15605
|
+
async function renameSources(cwd, path128) {
|
|
15606
15606
|
const fields = (await git(cwd, ["diff", "HEAD", "--name-status", "-z"])).split("\0");
|
|
15607
15607
|
const sources = [];
|
|
15608
15608
|
for (let i = 0; i < fields.length; ) {
|
|
15609
15609
|
const status2 = fields[i];
|
|
15610
15610
|
if (status2.startsWith("R")) {
|
|
15611
|
-
if (fields[i + 2] ===
|
|
15611
|
+
if (fields[i + 2] === path128) sources.push(fields[i + 1]);
|
|
15612
15612
|
i += 3;
|
|
15613
15613
|
} else {
|
|
15614
15614
|
i += status2.startsWith("C") ? 3 : 2;
|
|
@@ -15616,34 +15616,34 @@ async function renameSources(cwd, path126) {
|
|
|
15616
15616
|
}
|
|
15617
15617
|
return sources;
|
|
15618
15618
|
}
|
|
15619
|
-
async function restorePath(cwd,
|
|
15620
|
-
if (await isInHead(cwd,
|
|
15621
|
-
await git(cwd, ["checkout", "HEAD", "--",
|
|
15619
|
+
async function restorePath(cwd, path128) {
|
|
15620
|
+
if (await isInHead(cwd, path128)) {
|
|
15621
|
+
await git(cwd, ["checkout", "HEAD", "--", path128]);
|
|
15622
15622
|
return;
|
|
15623
15623
|
}
|
|
15624
|
-
if (await isTracked(cwd,
|
|
15625
|
-
await git(cwd, ["rm", "-f", "--",
|
|
15624
|
+
if (await isTracked(cwd, path128)) {
|
|
15625
|
+
await git(cwd, ["rm", "-f", "--", path128]);
|
|
15626
15626
|
return;
|
|
15627
15627
|
}
|
|
15628
|
-
await git(cwd, ["clean", "-f", "--",
|
|
15628
|
+
await git(cwd, ["clean", "-f", "--", path128]);
|
|
15629
15629
|
}
|
|
15630
|
-
async function revertPathChanges(cwd,
|
|
15631
|
-
if (!await hasChanges(cwd,
|
|
15632
|
-
throw new Error(`No uncommitted changes found for ${
|
|
15633
|
-
for (const target of [...await renameSources(cwd,
|
|
15630
|
+
async function revertPathChanges(cwd, path128) {
|
|
15631
|
+
if (!await hasChanges(cwd, path128))
|
|
15632
|
+
throw new Error(`No uncommitted changes found for ${path128}`);
|
|
15633
|
+
for (const target of [...await renameSources(cwd, path128), path128])
|
|
15634
15634
|
await restorePath(cwd, target);
|
|
15635
|
-
if (await hasChanges(cwd,
|
|
15636
|
-
throw new Error(`${
|
|
15635
|
+
if (await hasChanges(cwd, path128))
|
|
15636
|
+
throw new Error(`${path128} still has uncommitted changes`);
|
|
15637
15637
|
}
|
|
15638
15638
|
|
|
15639
15639
|
// src/commands/sessions/web/revertDiffFile.ts
|
|
15640
15640
|
async function revertDiffFile(req, res) {
|
|
15641
15641
|
const resolved = getFileTarget(req, res);
|
|
15642
15642
|
if (!resolved) return;
|
|
15643
|
-
const
|
|
15643
|
+
const path128 = relative5(repoRoot2(resolved.cwd), resolved.target);
|
|
15644
15644
|
try {
|
|
15645
|
-
await revertPathChanges(resolved.cwd,
|
|
15646
|
-
respondJson(res, 200, { reverted:
|
|
15645
|
+
await revertPathChanges(resolved.cwd, path128);
|
|
15646
|
+
respondJson(res, 200, { reverted: path128 });
|
|
15647
15647
|
} catch (error) {
|
|
15648
15648
|
respondJson(res, 500, {
|
|
15649
15649
|
error: error instanceof Error ? error.message : "Failed to revert file"
|
|
@@ -15755,7 +15755,7 @@ import { relative as relative6 } from "path";
|
|
|
15755
15755
|
function requestedPaths(body) {
|
|
15756
15756
|
const paths = body.paths;
|
|
15757
15757
|
if (!Array.isArray(paths)) return null;
|
|
15758
|
-
if (paths.some((
|
|
15758
|
+
if (paths.some((path128) => typeof path128 !== "string")) return null;
|
|
15759
15759
|
return paths;
|
|
15760
15760
|
}
|
|
15761
15761
|
async function revertDiffPaths(req, res) {
|
|
@@ -15775,10 +15775,10 @@ async function revertDiffPaths(req, res) {
|
|
|
15775
15775
|
const root2 = repoRoot2(cwd);
|
|
15776
15776
|
const reverted = [];
|
|
15777
15777
|
const failed3 = [];
|
|
15778
|
-
for (const
|
|
15779
|
-
const target = resolveWithinCwd(cwd,
|
|
15778
|
+
for (const path128 of paths) {
|
|
15779
|
+
const target = resolveWithinCwd(cwd, path128);
|
|
15780
15780
|
if (!target) {
|
|
15781
|
-
failed3.push({ path:
|
|
15781
|
+
failed3.push({ path: path128, error: "Path outside cwd" });
|
|
15782
15782
|
continue;
|
|
15783
15783
|
}
|
|
15784
15784
|
const relativePath = relative6(root2, target);
|
|
@@ -15871,13 +15871,13 @@ function describePeerError(error) {
|
|
|
15871
15871
|
const cause = error.cause;
|
|
15872
15872
|
return cause instanceof Error ? `${error.message}: ${describePeerError(cause)}` : error.message;
|
|
15873
15873
|
}
|
|
15874
|
-
async function fetchPeerJson(baseUrl2,
|
|
15875
|
-
const res = await fetch(new URL(
|
|
15874
|
+
async function fetchPeerJson(baseUrl2, path128, timeoutMs = PEER_TIMEOUT_MS) {
|
|
15875
|
+
const res = await fetch(new URL(path128, baseUrl2), {
|
|
15876
15876
|
signal: AbortSignal.timeout(timeoutMs)
|
|
15877
15877
|
});
|
|
15878
15878
|
if (!res.ok)
|
|
15879
15879
|
throw Object.assign(
|
|
15880
|
-
new Error(`GET ${
|
|
15880
|
+
new Error(`GET ${path128} returned ${res.status} ${res.statusText}`),
|
|
15881
15881
|
{ status: res.status }
|
|
15882
15882
|
);
|
|
15883
15883
|
return await res.json();
|
|
@@ -16278,8 +16278,8 @@ async function inviteTeamMember(client, appId, email) {
|
|
|
16278
16278
|
}
|
|
16279
16279
|
|
|
16280
16280
|
// src/commands/testflight/addInternalTester.ts
|
|
16281
|
-
async function hasMatch(client,
|
|
16282
|
-
const { data } = await client.get(
|
|
16281
|
+
async function hasMatch(client, path128, params, attribute, email) {
|
|
16282
|
+
const { data } = await client.get(path128, params);
|
|
16283
16283
|
return data.some(
|
|
16284
16284
|
(item) => String(item.attributes?.[attribute]).toLowerCase() === email.toLowerCase()
|
|
16285
16285
|
);
|
|
@@ -16320,9 +16320,9 @@ function parseErrors(body) {
|
|
|
16320
16320
|
return body ? [body] : [];
|
|
16321
16321
|
}
|
|
16322
16322
|
}
|
|
16323
|
-
function formatAscError(method,
|
|
16323
|
+
function formatAscError(method, path128, status2, body) {
|
|
16324
16324
|
const lines = [
|
|
16325
|
-
`App Store Connect ${method} ${
|
|
16325
|
+
`App Store Connect ${method} ${path128} failed (${status2})`,
|
|
16326
16326
|
...parseErrors(body).map((line) => ` ${line}`)
|
|
16327
16327
|
];
|
|
16328
16328
|
const hint = statusHints[status2];
|
|
@@ -16339,9 +16339,9 @@ var TestflightError = class extends Error {
|
|
|
16339
16339
|
function baseUrl() {
|
|
16340
16340
|
return process.env.ASSIST_ASC_BASE_URL ?? "https://api.appstoreconnect.apple.com";
|
|
16341
16341
|
}
|
|
16342
|
-
async function send(fetchFn, token, method,
|
|
16342
|
+
async function send(fetchFn, token, method, path128, body) {
|
|
16343
16343
|
try {
|
|
16344
|
-
return await fetchFn(`${baseUrl()}${
|
|
16344
|
+
return await fetchFn(`${baseUrl()}${path128}`, {
|
|
16345
16345
|
method,
|
|
16346
16346
|
headers: {
|
|
16347
16347
|
Authorization: `Bearer ${token}`,
|
|
@@ -16355,12 +16355,12 @@ async function send(fetchFn, token, method, path126, body) {
|
|
|
16355
16355
|
throw new TestflightError(`Failed to reach App Store Connect: ${reason4}`);
|
|
16356
16356
|
}
|
|
16357
16357
|
}
|
|
16358
|
-
async function ascRequest(fetchFn, token, method,
|
|
16359
|
-
const response = await send(fetchFn, token, method,
|
|
16358
|
+
async function ascRequest(fetchFn, token, method, path128, body) {
|
|
16359
|
+
const response = await send(fetchFn, token, method, path128, body);
|
|
16360
16360
|
const text18 = await response.text();
|
|
16361
16361
|
if (!response.ok) {
|
|
16362
16362
|
throw new TestflightError(
|
|
16363
|
-
formatAscError(method,
|
|
16363
|
+
formatAscError(method, path128.split("?")[0], response.status, text18)
|
|
16364
16364
|
);
|
|
16365
16365
|
}
|
|
16366
16366
|
return text18 ? JSON.parse(text18) : void 0;
|
|
@@ -16369,11 +16369,11 @@ async function ascRequest(fetchFn, token, method, path126, body) {
|
|
|
16369
16369
|
// src/commands/testflight/createAscClient.ts
|
|
16370
16370
|
function createAscClient(token, fetchFn = fetch) {
|
|
16371
16371
|
return {
|
|
16372
|
-
get: (
|
|
16372
|
+
get: (path128, params) => {
|
|
16373
16373
|
const query = params ? `?${new URLSearchParams(params)}` : "";
|
|
16374
|
-
return ascRequest(fetchFn, token, "GET", `${
|
|
16374
|
+
return ascRequest(fetchFn, token, "GET", `${path128}${query}`);
|
|
16375
16375
|
},
|
|
16376
|
-
post: (
|
|
16376
|
+
post: (path128, body) => ascRequest(fetchFn, token, "POST", path128, body)
|
|
16377
16377
|
};
|
|
16378
16378
|
}
|
|
16379
16379
|
|
|
@@ -16719,11 +16719,11 @@ function parseJson(raw) {
|
|
|
16719
16719
|
}
|
|
16720
16720
|
}
|
|
16721
16721
|
function formatIssue(key, issue) {
|
|
16722
|
-
const
|
|
16722
|
+
const path128 = formatConfigPath([
|
|
16723
16723
|
{ kind: "key", name: key },
|
|
16724
16724
|
...issue.path.map(toSegment)
|
|
16725
16725
|
]);
|
|
16726
|
-
return `${
|
|
16726
|
+
return `${path128}: ${issue.message}`;
|
|
16727
16727
|
}
|
|
16728
16728
|
function toSegment(part) {
|
|
16729
16729
|
return typeof part === "number" ? { kind: "index", index: part } : { kind: "key", name: String(part) };
|
|
@@ -16818,9 +16818,9 @@ function coerceUnion(key, raw, types) {
|
|
|
16818
16818
|
}
|
|
16819
16819
|
|
|
16820
16820
|
// src/shared/valueAtConfigPath.ts
|
|
16821
|
-
function valueAtConfigPath(value,
|
|
16821
|
+
function valueAtConfigPath(value, path128) {
|
|
16822
16822
|
let current2 = value;
|
|
16823
|
-
for (const key of
|
|
16823
|
+
for (const key of path128) {
|
|
16824
16824
|
if (typeof key === "number") {
|
|
16825
16825
|
if (!Array.isArray(current2)) return void 0;
|
|
16826
16826
|
current2 = current2[key];
|
|
@@ -16837,7 +16837,7 @@ function restoreConfigSecrets(value, stored, node) {
|
|
|
16837
16837
|
return mapConfigSecrets(
|
|
16838
16838
|
value,
|
|
16839
16839
|
node,
|
|
16840
|
-
(secret,
|
|
16840
|
+
(secret, path128) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path128) : secret
|
|
16841
16841
|
);
|
|
16842
16842
|
}
|
|
16843
16843
|
|
|
@@ -16866,8 +16866,8 @@ function formatIssue2(issue, key) {
|
|
|
16866
16866
|
return issue.keys.map(
|
|
16867
16867
|
(unrecognized) => `${[...issue.path, unrecognized].join(".")}: Unrecognized key`
|
|
16868
16868
|
);
|
|
16869
|
-
const
|
|
16870
|
-
return [`${
|
|
16869
|
+
const path128 = issue.path.length > 0 ? issue.path.join(".") : key;
|
|
16870
|
+
return [`${path128}: ${issue.message}`];
|
|
16871
16871
|
}
|
|
16872
16872
|
|
|
16873
16873
|
// src/commands/config/applyConfigSet.ts
|
|
@@ -16964,16 +16964,16 @@ async function readUserConfig(orm) {
|
|
|
16964
16964
|
import { mkdirSync as mkdirSync10, renameSync as renameSync3, writeFileSync as writeFileSync9 } from "fs";
|
|
16965
16965
|
import { dirname as dirname15 } from "path";
|
|
16966
16966
|
function writeRepoConfigCache(repos2, user = {}) {
|
|
16967
|
-
const
|
|
16968
|
-
mkdirSync10(dirname15(
|
|
16967
|
+
const path128 = repoConfigCachePath();
|
|
16968
|
+
mkdirSync10(dirname15(path128), { recursive: true });
|
|
16969
16969
|
const cache7 = {
|
|
16970
16970
|
refreshedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
16971
16971
|
repos: repos2,
|
|
16972
16972
|
user
|
|
16973
16973
|
};
|
|
16974
|
-
const tmp = `${
|
|
16974
|
+
const tmp = `${path128}.${process.pid}.tmp`;
|
|
16975
16975
|
writeFileSync9(tmp, JSON.stringify(cache7, null, 2));
|
|
16976
|
-
renameSync3(tmp,
|
|
16976
|
+
renameSync3(tmp, path128);
|
|
16977
16977
|
}
|
|
16978
16978
|
|
|
16979
16979
|
// src/shared/refreshRepoConfigCache.ts
|
|
@@ -17146,8 +17146,8 @@ function seesApp(item, appId) {
|
|
|
17146
17146
|
const linked = item.relationships?.visibleApps?.data;
|
|
17147
17147
|
return Array.isArray(linked) && linked.some((app) => app.id === appId);
|
|
17148
17148
|
}
|
|
17149
|
-
async function listEmails(client,
|
|
17150
|
-
const { data } = await client.get(
|
|
17149
|
+
async function listEmails(client, path128, type, emailAttribute, appId) {
|
|
17150
|
+
const { data } = await client.get(path128, {
|
|
17151
17151
|
include: "visibleApps",
|
|
17152
17152
|
[`fields[${type}]`]: `${emailAttribute},allAppsVisible,visibleApps`,
|
|
17153
17153
|
"fields[apps]": "bundleId",
|
|
@@ -17331,8 +17331,8 @@ function removeAt(container, keys) {
|
|
|
17331
17331
|
}
|
|
17332
17332
|
return removeFromChild(container, key, rest);
|
|
17333
17333
|
}
|
|
17334
|
-
function unsetNestedValue(obj,
|
|
17335
|
-
const { container, removed } = removeAt(obj,
|
|
17334
|
+
function unsetNestedValue(obj, path128) {
|
|
17335
|
+
const { container, removed } = removeAt(obj, path128.split("."));
|
|
17336
17336
|
return { config: container, removed };
|
|
17337
17337
|
}
|
|
17338
17338
|
|
|
@@ -17645,12 +17645,12 @@ var sessionsPrefix = "src/commands/sessions/";
|
|
|
17645
17645
|
var restartRules = [
|
|
17646
17646
|
{
|
|
17647
17647
|
target: "webserver",
|
|
17648
|
-
matches: (
|
|
17648
|
+
matches: (path128) => path128.startsWith(webUiPrefix),
|
|
17649
17649
|
advice: "restart the web server, then hard-reload the browser tab"
|
|
17650
17650
|
},
|
|
17651
17651
|
{
|
|
17652
17652
|
target: "daemon",
|
|
17653
|
-
matches: (
|
|
17653
|
+
matches: (path128) => path128.startsWith(sessionsPrefix) && !path128.startsWith(webUiPrefix),
|
|
17654
17654
|
advice: "restart the daemon"
|
|
17655
17655
|
}
|
|
17656
17656
|
];
|
|
@@ -17715,11 +17715,11 @@ import { basename as basename13, join as join41 } from "path";
|
|
|
17715
17715
|
// src/commands/sessions/daemon/worktree/canonicalTreePath.ts
|
|
17716
17716
|
import { realpathSync as realpathSync2 } from "fs";
|
|
17717
17717
|
import { resolve as resolve12 } from "path";
|
|
17718
|
-
function canonicalTreePath(
|
|
17718
|
+
function canonicalTreePath(path128) {
|
|
17719
17719
|
try {
|
|
17720
|
-
return realpathSync2(
|
|
17720
|
+
return realpathSync2(path128);
|
|
17721
17721
|
} catch {
|
|
17722
|
-
return resolve12(
|
|
17722
|
+
return resolve12(path128);
|
|
17723
17723
|
}
|
|
17724
17724
|
}
|
|
17725
17725
|
|
|
@@ -18463,22 +18463,22 @@ function scheduleReconnect() {
|
|
|
18463
18463
|
import { mkdirSync as mkdirSync11, readFileSync as readFileSync20, writeFileSync as writeFileSync10 } from "fs";
|
|
18464
18464
|
import { dirname as dirname20, join as join45 } from "path";
|
|
18465
18465
|
var defaultPath = join45(daemonPaths.dir, "auto-restart-attempts.json");
|
|
18466
|
-
function read(
|
|
18466
|
+
function read(path128) {
|
|
18467
18467
|
try {
|
|
18468
|
-
return JSON.parse(readFileSync20(
|
|
18468
|
+
return JSON.parse(readFileSync20(path128, "utf8"));
|
|
18469
18469
|
} catch {
|
|
18470
18470
|
return {};
|
|
18471
18471
|
}
|
|
18472
18472
|
}
|
|
18473
|
-
function autoRestartAttempts(port,
|
|
18473
|
+
function autoRestartAttempts(port, path128 = defaultPath) {
|
|
18474
18474
|
const key = String(port);
|
|
18475
18475
|
return {
|
|
18476
|
-
get: () => read(
|
|
18476
|
+
get: () => read(path128)[key],
|
|
18477
18477
|
set: (built) => {
|
|
18478
|
-
mkdirSync11(dirname20(
|
|
18478
|
+
mkdirSync11(dirname20(path128), { recursive: true });
|
|
18479
18479
|
writeFileSync10(
|
|
18480
|
-
|
|
18481
|
-
`${JSON.stringify({ ...read(
|
|
18480
|
+
path128,
|
|
18481
|
+
`${JSON.stringify({ ...read(path128), [key]: built }, null, 2)}
|
|
18482
18482
|
`
|
|
18483
18483
|
);
|
|
18484
18484
|
}
|
|
@@ -18788,29 +18788,29 @@ function gitCommonDir(cwd) {
|
|
|
18788
18788
|
var REGISTRY_FILE = "worktrees.json";
|
|
18789
18789
|
function readWorktreeRegistry() {
|
|
18790
18790
|
const data = loadJson(REGISTRY_FILE);
|
|
18791
|
-
return Object.entries(data).filter(([, record3]) => !record3.reaped).map(([
|
|
18791
|
+
return Object.entries(data).filter(([, record3]) => !record3.reaped).map(([path128, { reaped: _reaped, ...record3 }]) => ({ path: path128, ...record3 }));
|
|
18792
18792
|
}
|
|
18793
|
-
function worktreeAttributionIncludingReaped(
|
|
18794
|
-
const record3 = loadJson(REGISTRY_FILE)[
|
|
18793
|
+
function worktreeAttributionIncludingReaped(path128) {
|
|
18794
|
+
const record3 = loadJson(REGISTRY_FILE)[path128];
|
|
18795
18795
|
return record3 ? { clone: record3.clone, origin: record3.origin } : void 0;
|
|
18796
18796
|
}
|
|
18797
|
-
function recordWorktree(
|
|
18797
|
+
function recordWorktree(path128, clone, origin) {
|
|
18798
18798
|
const data = loadJson(REGISTRY_FILE);
|
|
18799
|
-
data[
|
|
18799
|
+
data[path128] = { clone, origin };
|
|
18800
18800
|
saveJson(REGISTRY_FILE, data);
|
|
18801
18801
|
}
|
|
18802
|
-
function recordWorktreeHarness(
|
|
18802
|
+
function recordWorktreeHarness(path128, harness) {
|
|
18803
18803
|
const data = loadJson(REGISTRY_FILE);
|
|
18804
|
-
const record3 = data[
|
|
18804
|
+
const record3 = data[path128];
|
|
18805
18805
|
if (!record3 || record3.reaped || record3.harness === harness) return;
|
|
18806
|
-
data[
|
|
18806
|
+
data[path128] = { ...record3, harness };
|
|
18807
18807
|
saveJson(REGISTRY_FILE, data);
|
|
18808
18808
|
}
|
|
18809
|
-
function forgetWorktree(
|
|
18809
|
+
function forgetWorktree(path128) {
|
|
18810
18810
|
const data = loadJson(REGISTRY_FILE);
|
|
18811
|
-
const record3 = data[
|
|
18811
|
+
const record3 = data[path128];
|
|
18812
18812
|
if (!record3 || record3.reaped) return;
|
|
18813
|
-
data[
|
|
18813
|
+
data[path128] = { ...record3, reaped: true };
|
|
18814
18814
|
saveJson(REGISTRY_FILE, data);
|
|
18815
18815
|
}
|
|
18816
18816
|
|
|
@@ -20894,9 +20894,9 @@ function toAnswers(value) {
|
|
|
20894
20894
|
function toAttachments(value) {
|
|
20895
20895
|
if (!Array.isArray(value)) return void 0;
|
|
20896
20896
|
return value.flatMap((entry) => {
|
|
20897
|
-
const { path:
|
|
20898
|
-
if (typeof
|
|
20899
|
-
const attachment = { path:
|
|
20897
|
+
const { path: path128, alt, group } = entry ?? {};
|
|
20898
|
+
if (typeof path128 !== "string" || path128 === "") return [];
|
|
20899
|
+
const attachment = { path: path128, alt: typeof alt === "string" ? alt : "" };
|
|
20900
20900
|
return [
|
|
20901
20901
|
typeof group === "string" && group !== "" ? { ...attachment, group } : attachment
|
|
20902
20902
|
];
|
|
@@ -20930,8 +20930,8 @@ function isReviewComment(value) {
|
|
|
20930
20930
|
}
|
|
20931
20931
|
function toReviewComments(value) {
|
|
20932
20932
|
if (!Array.isArray(value)) return void 0;
|
|
20933
|
-
return value.filter(isReviewComment).map(({ path:
|
|
20934
|
-
path:
|
|
20933
|
+
return value.filter(isReviewComment).map(({ path: path128, startLine, endLine, quote, note, startSide, side }) => ({
|
|
20934
|
+
path: path128,
|
|
20935
20935
|
startLine,
|
|
20936
20936
|
endLine,
|
|
20937
20937
|
quote,
|
|
@@ -22115,8 +22115,8 @@ async function recordGitRef(db, itemId2, ref) {
|
|
|
22115
22115
|
function gitRefUrl(kind, ref, cwd) {
|
|
22116
22116
|
const repo = getPreferredRemoteRepo(cwd);
|
|
22117
22117
|
if (!repo) return void 0;
|
|
22118
|
-
const
|
|
22119
|
-
return `https://github.com/${repo.org}/${repo.repo}/${
|
|
22118
|
+
const path128 = kind === "branch" ? "tree" : "commit";
|
|
22119
|
+
return `https://github.com/${repo.org}/${repo.repo}/${path128}/${ref}`;
|
|
22120
22120
|
}
|
|
22121
22121
|
|
|
22122
22122
|
// src/commands/sessions/summarise/readTranscriptHead.ts
|
|
@@ -22487,9 +22487,9 @@ function originToSshUrl(origin) {
|
|
|
22487
22487
|
const firstSlash = origin.indexOf("/");
|
|
22488
22488
|
if (firstSlash <= 0) return null;
|
|
22489
22489
|
const host = origin.slice(0, firstSlash);
|
|
22490
|
-
const
|
|
22491
|
-
if (!
|
|
22492
|
-
return `git@${host}:${
|
|
22490
|
+
const path128 = origin.slice(firstSlash + 1);
|
|
22491
|
+
if (!path128) return null;
|
|
22492
|
+
return `git@${host}:${path128}.git`;
|
|
22493
22493
|
}
|
|
22494
22494
|
|
|
22495
22495
|
// src/commands/backlog/cloneRepo.ts
|
|
@@ -23344,44 +23344,44 @@ import { randomUUID as randomUUID10 } from "crypto";
|
|
|
23344
23344
|
// src/commands/backlog/propose/mutateLedger.ts
|
|
23345
23345
|
import { mkdirSync as mkdirSync15, readFileSync as readFileSync32, renameSync as renameSync4, writeFileSync as writeFileSync24 } from "fs";
|
|
23346
23346
|
import { dirname as dirname30 } from "path";
|
|
23347
|
-
function readLedger(
|
|
23347
|
+
function readLedger(path128) {
|
|
23348
23348
|
try {
|
|
23349
|
-
const parsed = JSON.parse(readFileSync32(
|
|
23349
|
+
const parsed = JSON.parse(readFileSync32(path128, "utf8"));
|
|
23350
23350
|
return { open: parsed.open ?? [], created: parsed.created };
|
|
23351
23351
|
} catch {
|
|
23352
23352
|
return { open: [] };
|
|
23353
23353
|
}
|
|
23354
23354
|
}
|
|
23355
|
-
function mutateLedger(
|
|
23356
|
-
const ledger = readLedger(
|
|
23355
|
+
function mutateLedger(path128, mutate) {
|
|
23356
|
+
const ledger = readLedger(path128);
|
|
23357
23357
|
mutate(ledger);
|
|
23358
|
-
mkdirSync15(dirname30(
|
|
23359
|
-
const tmp = `${
|
|
23358
|
+
mkdirSync15(dirname30(path128), { recursive: true });
|
|
23359
|
+
const tmp = `${path128}.${process.pid}.tmp`;
|
|
23360
23360
|
writeFileSync24(tmp, JSON.stringify(ledger));
|
|
23361
|
-
renameSync4(tmp,
|
|
23361
|
+
renameSync4(tmp, path128);
|
|
23362
23362
|
}
|
|
23363
23363
|
|
|
23364
23364
|
// src/commands/backlog/propose/findPredecessor.ts
|
|
23365
23365
|
var GRACE_MS2 = 5e3;
|
|
23366
23366
|
var SIBLING_WAIT_MS = 5e3;
|
|
23367
23367
|
var POLL_MS = 100;
|
|
23368
|
-
function knownPredecessor(
|
|
23369
|
-
const { created } = readLedger(
|
|
23368
|
+
function knownPredecessor(path128, startedAt) {
|
|
23369
|
+
const { created } = readLedger(path128);
|
|
23370
23370
|
if (!created) return void 0;
|
|
23371
23371
|
if (created.startedAt > startedAt) return void 0;
|
|
23372
23372
|
if (created.at < startedAt - GRACE_MS2) return void 0;
|
|
23373
23373
|
return created.itemId;
|
|
23374
23374
|
}
|
|
23375
|
-
function hasOlderOpenSibling(
|
|
23376
|
-
return readLedger(
|
|
23375
|
+
function hasOlderOpenSibling(path128, token, startedAt) {
|
|
23376
|
+
return readLedger(path128).open.some(
|
|
23377
23377
|
(p) => p.token !== token && p.startedAt <= startedAt
|
|
23378
23378
|
);
|
|
23379
23379
|
}
|
|
23380
|
-
async function findPredecessor(
|
|
23380
|
+
async function findPredecessor(path128, token, startedAt) {
|
|
23381
23381
|
const deadline = Date.now() + SIBLING_WAIT_MS;
|
|
23382
|
-
while (hasOlderOpenSibling(
|
|
23382
|
+
while (hasOlderOpenSibling(path128, token, startedAt) && Date.now() < deadline)
|
|
23383
23383
|
await new Promise((resolve36) => setTimeout(resolve36, POLL_MS));
|
|
23384
|
-
return knownPredecessor(
|
|
23384
|
+
return knownPredecessor(path128, startedAt);
|
|
23385
23385
|
}
|
|
23386
23386
|
|
|
23387
23387
|
// src/commands/backlog/propose/proposalLedgerPath.ts
|
|
@@ -23394,10 +23394,10 @@ function proposalLedgerPath(sessionId2) {
|
|
|
23394
23394
|
// src/commands/backlog/propose/trackProposal.ts
|
|
23395
23395
|
var STALE_OPEN_MS = 60 * 6e4;
|
|
23396
23396
|
function trackProposal(sessionId2) {
|
|
23397
|
-
const
|
|
23397
|
+
const path128 = proposalLedgerPath(sessionId2);
|
|
23398
23398
|
const token = randomUUID10();
|
|
23399
23399
|
const startedAt = Date.now();
|
|
23400
|
-
mutateLedger(
|
|
23400
|
+
mutateLedger(path128, (ledger) => {
|
|
23401
23401
|
ledger.open = ledger.open.filter(
|
|
23402
23402
|
(p) => startedAt - p.startedAt < STALE_OPEN_MS
|
|
23403
23403
|
);
|
|
@@ -23408,15 +23408,15 @@ function trackProposal(sessionId2) {
|
|
|
23408
23408
|
if (closed) return;
|
|
23409
23409
|
closed = true;
|
|
23410
23410
|
process.off("exit", close);
|
|
23411
|
-
mutateLedger(
|
|
23411
|
+
mutateLedger(path128, (ledger) => {
|
|
23412
23412
|
ledger.open = ledger.open.filter((p) => p.token !== token);
|
|
23413
23413
|
});
|
|
23414
23414
|
};
|
|
23415
23415
|
process.on("exit", close);
|
|
23416
23416
|
return {
|
|
23417
|
-
knownPredecessor: () => knownPredecessor(
|
|
23418
|
-
findPredecessor: () => findPredecessor(
|
|
23419
|
-
recordCreated: (itemId2) => mutateLedger(
|
|
23417
|
+
knownPredecessor: () => knownPredecessor(path128, startedAt),
|
|
23418
|
+
findPredecessor: () => findPredecessor(path128, token, startedAt),
|
|
23419
|
+
recordCreated: (itemId2) => mutateLedger(path128, (ledger) => {
|
|
23420
23420
|
ledger.created = { itemId: itemId2, at: Date.now(), startedAt };
|
|
23421
23421
|
}),
|
|
23422
23422
|
close
|
|
@@ -24590,10 +24590,10 @@ import { existsSync as existsSync53, unwatchFile, watchFile } from "fs";
|
|
|
24590
24590
|
// src/commands/backlog/readSignal.ts
|
|
24591
24591
|
import { existsSync as existsSync52, readFileSync as readFileSync35 } from "fs";
|
|
24592
24592
|
function readSignal() {
|
|
24593
|
-
const
|
|
24594
|
-
if (!
|
|
24593
|
+
const path128 = getSignalPath();
|
|
24594
|
+
if (!path128 || !existsSync52(path128)) return void 0;
|
|
24595
24595
|
try {
|
|
24596
|
-
return JSON.parse(readFileSync35(
|
|
24596
|
+
return JSON.parse(readFileSync35(path128, "utf8"));
|
|
24597
24597
|
} catch {
|
|
24598
24598
|
return void 0;
|
|
24599
24599
|
}
|
|
@@ -24805,13 +24805,13 @@ function activityPath(sessionId2) {
|
|
|
24805
24805
|
function emitActivity(activity2) {
|
|
24806
24806
|
const sessionId2 = process.env.ASSIST_ACTIVITY_ID;
|
|
24807
24807
|
if (!sessionId2) return;
|
|
24808
|
-
const
|
|
24809
|
-
mkdirSync18(dirname31(
|
|
24810
|
-
writeFileSync27(
|
|
24808
|
+
const path128 = activityPath(sessionId2);
|
|
24809
|
+
mkdirSync18(dirname31(path128), { recursive: true });
|
|
24810
|
+
writeFileSync27(path128, JSON.stringify({ ...activity2, startedAt: Date.now() }));
|
|
24811
24811
|
}
|
|
24812
|
-
function readActivity(
|
|
24812
|
+
function readActivity(path128) {
|
|
24813
24813
|
try {
|
|
24814
|
-
return JSON.parse(readFileSync36(
|
|
24814
|
+
return JSON.parse(readFileSync36(path128, "utf8"));
|
|
24815
24815
|
} catch {
|
|
24816
24816
|
return void 0;
|
|
24817
24817
|
}
|
|
@@ -24821,15 +24821,15 @@ function reconcileActivity(sessionId2, activity2) {
|
|
|
24821
24821
|
removeActivity(sessionId2);
|
|
24822
24822
|
return;
|
|
24823
24823
|
}
|
|
24824
|
-
const
|
|
24825
|
-
mkdirSync18(dirname31(
|
|
24826
|
-
writeFileSync27(
|
|
24824
|
+
const path128 = activityPath(sessionId2);
|
|
24825
|
+
mkdirSync18(dirname31(path128), { recursive: true });
|
|
24826
|
+
writeFileSync27(path128, JSON.stringify(activity2));
|
|
24827
24827
|
}
|
|
24828
24828
|
function writeActivityIfAbsent(sessionId2, activity2) {
|
|
24829
|
-
const
|
|
24830
|
-
mkdirSync18(dirname31(
|
|
24829
|
+
const path128 = activityPath(sessionId2);
|
|
24830
|
+
mkdirSync18(dirname31(path128), { recursive: true });
|
|
24831
24831
|
try {
|
|
24832
|
-
writeFileSync27(
|
|
24832
|
+
writeFileSync27(path128, JSON.stringify(activity2), { flag: "wx" });
|
|
24833
24833
|
return true;
|
|
24834
24834
|
} catch (error) {
|
|
24835
24835
|
if (error.code === "EEXIST") return false;
|
|
@@ -27197,9 +27197,9 @@ function isGhGraphqlIssueMutation(command) {
|
|
|
27197
27197
|
(m) => ISSUE_MUTATION.test(readOrEmpty(m[1]))
|
|
27198
27198
|
);
|
|
27199
27199
|
}
|
|
27200
|
-
function readOrEmpty(
|
|
27200
|
+
function readOrEmpty(path128) {
|
|
27201
27201
|
try {
|
|
27202
|
-
return readFileSync37(
|
|
27202
|
+
return readFileSync37(path128, "utf8");
|
|
27203
27203
|
} catch {
|
|
27204
27204
|
return "";
|
|
27205
27205
|
}
|
|
@@ -27336,13 +27336,13 @@ function findBuiltinDenyRaw(rawCommand) {
|
|
|
27336
27336
|
|
|
27337
27337
|
// src/commands/cliHook/findRestrictedPathDeny.ts
|
|
27338
27338
|
var RESTRICTED_PATHS = [".assist/restricted"];
|
|
27339
|
-
function restrictedPathRegex(
|
|
27340
|
-
const pattern2 =
|
|
27339
|
+
function restrictedPathRegex(path128) {
|
|
27340
|
+
const pattern2 = path128.split("/").map((segment) => segment.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`)).join(String.raw`[/\\]`);
|
|
27341
27341
|
return new RegExp(pattern2);
|
|
27342
27342
|
}
|
|
27343
|
-
var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((
|
|
27344
|
-
path:
|
|
27345
|
-
regex: restrictedPathRegex(
|
|
27343
|
+
var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((path128) => ({
|
|
27344
|
+
path: path128,
|
|
27345
|
+
regex: restrictedPathRegex(path128)
|
|
27346
27346
|
}));
|
|
27347
27347
|
function findRestrictedPathDenyRaw(rawCommand) {
|
|
27348
27348
|
const rule = RESTRICTED_PATH_RULES.find(
|
|
@@ -27562,9 +27562,9 @@ var __dirname4 = dirname32(__filename3);
|
|
|
27562
27562
|
function packageRoot() {
|
|
27563
27563
|
return __dirname4;
|
|
27564
27564
|
}
|
|
27565
|
-
function readLines(
|
|
27566
|
-
if (!existsSync55(
|
|
27567
|
-
return readFileSync38(
|
|
27565
|
+
function readLines(path128) {
|
|
27566
|
+
if (!existsSync55(path128)) return [];
|
|
27567
|
+
return readFileSync38(path128, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
27568
27568
|
}
|
|
27569
27569
|
var cachedReads;
|
|
27570
27570
|
var cachedWrites;
|
|
@@ -27906,9 +27906,9 @@ import { relative as relative8, resolve as resolve21 } from "path";
|
|
|
27906
27906
|
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.";
|
|
27907
27907
|
var FIXED_SCHEMA_PATH = /^src\/shared\/db\/(?:migrations\/migration\d{4}[^/]*\.ts|migrations\.ts|schema\.ts)$/;
|
|
27908
27908
|
var DB_MODULE = /^src\/shared\/db\/[^/]+\.ts$/;
|
|
27909
|
-
function readOrEmpty2(
|
|
27909
|
+
function readOrEmpty2(path128) {
|
|
27910
27910
|
try {
|
|
27911
|
-
return readFileSync40(
|
|
27911
|
+
return readFileSync40(path128, "utf8");
|
|
27912
27912
|
} catch {
|
|
27913
27913
|
return "";
|
|
27914
27914
|
}
|
|
@@ -27976,9 +27976,9 @@ function findSchemaPathDeny(toolName, rawCommand, root2 = getProjectRoot()) {
|
|
|
27976
27976
|
|
|
27977
27977
|
// src/commands/editHook/decideDocsGuard.ts
|
|
27978
27978
|
async function decideDocsGuard({
|
|
27979
|
-
path:
|
|
27979
|
+
path: path128
|
|
27980
27980
|
}) {
|
|
27981
|
-
if (!isDocsPath(
|
|
27981
|
+
if (!isDocsPath(path128)) return void 0;
|
|
27982
27982
|
return await isDocsLocked() ? DOCS_LOCK_REASON : void 0;
|
|
27983
27983
|
}
|
|
27984
27984
|
|
|
@@ -28012,10 +28012,10 @@ function getSchemaSessionApprovalPath(scope) {
|
|
|
28012
28012
|
}
|
|
28013
28013
|
|
|
28014
28014
|
// src/commands/schema/isSchemaLocked.ts
|
|
28015
|
-
function approvalMatches(
|
|
28015
|
+
function approvalMatches(path128, identity) {
|
|
28016
28016
|
try {
|
|
28017
28017
|
const approval = JSON.parse(
|
|
28018
|
-
readFileSync41(
|
|
28018
|
+
readFileSync41(path128, "utf8")
|
|
28019
28019
|
);
|
|
28020
28020
|
const conversation = approval.conversationId ?? approval.claudeSessionId;
|
|
28021
28021
|
if (approval.harness !== void 0 && approval.harness !== identity.harness)
|
|
@@ -28028,8 +28028,8 @@ function approvalMatches(path126, identity) {
|
|
|
28028
28028
|
function hasSessionApproval(identity) {
|
|
28029
28029
|
const { harness, conversationId } = identity;
|
|
28030
28030
|
if (!conversationId) return false;
|
|
28031
|
-
const
|
|
28032
|
-
return
|
|
28031
|
+
const path128 = getSchemaSessionApprovalPath({ harness, conversationId });
|
|
28032
|
+
return path128 !== void 0 && existsSync57(path128) && approvalMatches(path128, identity);
|
|
28033
28033
|
}
|
|
28034
28034
|
async function isSchemaLocked(identity = currentExecutionIdentity()) {
|
|
28035
28035
|
if (!identity) return false;
|
|
@@ -28049,8 +28049,8 @@ async function isSchemaLocked(identity = currentExecutionIdentity()) {
|
|
|
28049
28049
|
}
|
|
28050
28050
|
|
|
28051
28051
|
// src/commands/editHook/decideSchemaGuard.ts
|
|
28052
|
-
async function decideSchemaGuard({ path:
|
|
28053
|
-
if (!isSchemaPath(
|
|
28052
|
+
async function decideSchemaGuard({ path: path128, contents }, identity) {
|
|
28053
|
+
if (!isSchemaPath(path128, contents)) return void 0;
|
|
28054
28054
|
return await isSchemaLocked(identity) ? SCHEMA_LOCK_REASON : void 0;
|
|
28055
28055
|
}
|
|
28056
28056
|
|
|
@@ -28343,14 +28343,14 @@ function showProgress(p, label) {
|
|
|
28343
28343
|
const pct = Math.round(p.done / p.total * 100);
|
|
28344
28344
|
process.stderr.write(`\r\x1B[K[${pct}%] Scanning ${label}...`);
|
|
28345
28345
|
}
|
|
28346
|
-
async function resolveCommand2(cli,
|
|
28347
|
-
showProgress(p,
|
|
28348
|
-
const subHelp = await runHelp([cli, ...
|
|
28346
|
+
async function resolveCommand2(cli, path128, description, depth, p) {
|
|
28347
|
+
showProgress(p, path128.join(" "));
|
|
28348
|
+
const subHelp = await runHelp([cli, ...path128]);
|
|
28349
28349
|
if (!subHelp || !hasSubcommands(subHelp)) {
|
|
28350
|
-
return [{ path:
|
|
28350
|
+
return [{ path: path128, description }];
|
|
28351
28351
|
}
|
|
28352
|
-
const children = await discoverAt(cli,
|
|
28353
|
-
return children.length > 0 ? children : [{ path:
|
|
28352
|
+
const children = await discoverAt(cli, path128, depth + 1, p);
|
|
28353
|
+
return children.length > 0 ? children : [{ path: path128, description }];
|
|
28354
28354
|
}
|
|
28355
28355
|
async function discoverAt(cli, parentPath, depth, p) {
|
|
28356
28356
|
if (depth > SAFETY_DEPTH) return [];
|
|
@@ -28498,9 +28498,9 @@ function logPath(cli) {
|
|
|
28498
28498
|
return join68(homedir22(), ".assist", `cli-discover-${safeName}.log`);
|
|
28499
28499
|
}
|
|
28500
28500
|
function readCache(cli) {
|
|
28501
|
-
const
|
|
28502
|
-
if (!existsSync58(
|
|
28503
|
-
return readFileSync42(
|
|
28501
|
+
const path128 = logPath(cli);
|
|
28502
|
+
if (!existsSync58(path128)) return void 0;
|
|
28503
|
+
return readFileSync42(path128, "utf8");
|
|
28504
28504
|
}
|
|
28505
28505
|
function writeCache(cli, output) {
|
|
28506
28506
|
const dir = join68(homedir22(), ".assist");
|
|
@@ -28680,9 +28680,9 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
28680
28680
|
}
|
|
28681
28681
|
const cutoff = Date.now() - STALE_AFTER_MS;
|
|
28682
28682
|
for (const entry of entries) {
|
|
28683
|
-
const
|
|
28683
|
+
const path128 = join69(dir, entry);
|
|
28684
28684
|
try {
|
|
28685
|
-
if (statSync11(
|
|
28685
|
+
if (statSync11(path128).mtimeMs < cutoff) unlinkSync8(path128);
|
|
28686
28686
|
} catch {
|
|
28687
28687
|
continue;
|
|
28688
28688
|
}
|
|
@@ -28692,10 +28692,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
28692
28692
|
// src/commands/codeComment/readPinState.ts
|
|
28693
28693
|
import { existsSync as existsSync59, readFileSync as readFileSync43 } from "fs";
|
|
28694
28694
|
function readPinState(pin2) {
|
|
28695
|
-
const
|
|
28696
|
-
if (!existsSync59(
|
|
28695
|
+
const path128 = getPinStatePath(pin2);
|
|
28696
|
+
if (!existsSync59(path128)) return void 0;
|
|
28697
28697
|
try {
|
|
28698
|
-
const state = JSON.parse(readFileSync43(
|
|
28698
|
+
const state = JSON.parse(readFileSync43(path128, "utf8"));
|
|
28699
28699
|
if (state.pin !== pin2) return void 0;
|
|
28700
28700
|
return state;
|
|
28701
28701
|
} catch {
|
|
@@ -29435,8 +29435,8 @@ function findUnmergedPaths() {
|
|
|
29435
29435
|
}
|
|
29436
29436
|
const found = /* @__PURE__ */ new Set();
|
|
29437
29437
|
for (const line of output.split("\n")) {
|
|
29438
|
-
const
|
|
29439
|
-
if (
|
|
29438
|
+
const path128 = line.split(" ")[1];
|
|
29439
|
+
if (path128) found.add(path128.trim());
|
|
29440
29440
|
}
|
|
29441
29441
|
return [...found];
|
|
29442
29442
|
}
|
|
@@ -30628,8 +30628,8 @@ function diffRepoConfigLeaves(current2, incoming) {
|
|
|
30628
30628
|
}
|
|
30629
30629
|
function leaves(node, prefix2 = "") {
|
|
30630
30630
|
return Object.entries(node).flatMap(([key, value]) => {
|
|
30631
|
-
const
|
|
30632
|
-
return isPlainObject4(value) && Object.keys(value).length > 0 ? leaves(value,
|
|
30631
|
+
const path128 = prefix2 ? `${prefix2}.${key}` : key;
|
|
30632
|
+
return isPlainObject4(value) && Object.keys(value).length > 0 ? leaves(value, path128) : [[path128, value]];
|
|
30633
30633
|
});
|
|
30634
30634
|
}
|
|
30635
30635
|
function isPlainObject4(value) {
|
|
@@ -31260,10 +31260,10 @@ async function browserSnapshot(options2) {
|
|
|
31260
31260
|
op: "snapshot",
|
|
31261
31261
|
url: options2.url
|
|
31262
31262
|
});
|
|
31263
|
-
const
|
|
31264
|
-
mkdirSync22(dirname35(
|
|
31265
|
-
writeFileSync32(
|
|
31266
|
-
console.log(`snapshot: ${
|
|
31263
|
+
const path128 = snapshotPath(result.tabUrl, /* @__PURE__ */ new Date());
|
|
31264
|
+
mkdirSync22(dirname35(path128), { recursive: true });
|
|
31265
|
+
writeFileSync32(path128, result.html);
|
|
31266
|
+
console.log(`snapshot: ${path128}`);
|
|
31267
31267
|
}
|
|
31268
31268
|
|
|
31269
31269
|
// src/commands/browser/formatExtensionUpdate.ts
|
|
@@ -31438,9 +31438,9 @@ async function loadPath(source) {
|
|
|
31438
31438
|
}
|
|
31439
31439
|
}
|
|
31440
31440
|
async function extension() {
|
|
31441
|
-
const
|
|
31441
|
+
const path128 = await loadPath(extensionDir());
|
|
31442
31442
|
console.log(chalk155.bold("assist \u2014 GitHub browser extension"));
|
|
31443
|
-
console.log(chalk155.dim(`load the unpacked extension from ${
|
|
31443
|
+
console.log(chalk155.dim(`load the unpacked extension from ${path128}`));
|
|
31444
31444
|
}
|
|
31445
31445
|
|
|
31446
31446
|
// src/commands/extension/printExtensionUrl.ts
|
|
@@ -31535,7 +31535,7 @@ async function stageExtension(source, staging, version2) {
|
|
|
31535
31535
|
await mkdir5(staging, { recursive: true });
|
|
31536
31536
|
await cp3(source, staging, {
|
|
31537
31537
|
recursive: true,
|
|
31538
|
-
filter: (
|
|
31538
|
+
filter: (path128) => basename18(path128) !== "updates.json"
|
|
31539
31539
|
});
|
|
31540
31540
|
const manifest = join76(staging, "manifest.json");
|
|
31541
31541
|
const stamped = stampManifestVersion(
|
|
@@ -31616,10 +31616,10 @@ async function signExtension() {
|
|
|
31616
31616
|
return;
|
|
31617
31617
|
}
|
|
31618
31618
|
await writeUpdateManifest(source, ARTIFACTS_DIR, version2);
|
|
31619
|
-
const
|
|
31619
|
+
const path128 = await signedAddonInstallPath(
|
|
31620
31620
|
await copySignedXpi(xpi, ARTIFACTS_DIR)
|
|
31621
31621
|
);
|
|
31622
|
-
console.log(chalk158.dim(`install the signed add-on from ${
|
|
31622
|
+
console.log(chalk158.dim(`install the signed add-on from ${path128}`));
|
|
31623
31623
|
}
|
|
31624
31624
|
|
|
31625
31625
|
// src/commands/registerExtension.ts
|
|
@@ -31885,17 +31885,17 @@ function devEntryPath(repoName, week, devDir) {
|
|
|
31885
31885
|
function asString(value) {
|
|
31886
31886
|
return value === void 0 || value === null ? null : String(value);
|
|
31887
31887
|
}
|
|
31888
|
-
function readFrontmatter(
|
|
31888
|
+
function readFrontmatter(path128) {
|
|
31889
31889
|
try {
|
|
31890
|
-
const match = readFileSync48(
|
|
31890
|
+
const match = readFileSync48(path128, "utf8").match(/^---\n([\s\S]*?)\n---/);
|
|
31891
31891
|
return match ? parseYaml3(match[1]) ?? {} : null;
|
|
31892
31892
|
} catch {
|
|
31893
31893
|
return null;
|
|
31894
31894
|
}
|
|
31895
31895
|
}
|
|
31896
31896
|
function loadDevEntry(repoName, week, devDir) {
|
|
31897
|
-
const
|
|
31898
|
-
const frontmatter2 = readFrontmatter(
|
|
31897
|
+
const path128 = devEntryPath(repoName, week, devDir);
|
|
31898
|
+
const frontmatter2 = readFrontmatter(path128);
|
|
31899
31899
|
if (!frontmatter2) return null;
|
|
31900
31900
|
const versions = frontmatter2.versions;
|
|
31901
31901
|
return {
|
|
@@ -32291,11 +32291,11 @@ function fail7(message4) {
|
|
|
32291
32291
|
console.error(chalk168.red(message4));
|
|
32292
32292
|
process.exit(1);
|
|
32293
32293
|
}
|
|
32294
|
-
function readEntry(
|
|
32294
|
+
function readEntry(path128) {
|
|
32295
32295
|
try {
|
|
32296
|
-
return readFileSync50(
|
|
32296
|
+
return readFileSync50(path128, "utf8");
|
|
32297
32297
|
} catch {
|
|
32298
|
-
fail7(`No dev entry at ${
|
|
32298
|
+
fail7(`No dev entry at ${path128}`);
|
|
32299
32299
|
}
|
|
32300
32300
|
}
|
|
32301
32301
|
function resolveValue(permalink, skipped) {
|
|
@@ -32312,11 +32312,11 @@ function resolveValue(permalink, skipped) {
|
|
|
32312
32312
|
function posted(week, permalink, options2 = {}) {
|
|
32313
32313
|
if (!isValidWeek(week)) fail7("Invalid week. Use YYYY-Www (e.g. 2026-W33)");
|
|
32314
32314
|
const value = resolveValue(permalink, options2.skip === true);
|
|
32315
|
-
const
|
|
32316
|
-
const updated2 = setFrontmatterSlack(readEntry(
|
|
32317
|
-
if (updated2 === null) fail7(`${
|
|
32318
|
-
writeFileSync34(
|
|
32319
|
-
console.log(chalk168.green(`Recorded slack: ${value} in ${
|
|
32315
|
+
const path128 = devEntryPath(getRepoName(), week, resolveDevDir());
|
|
32316
|
+
const updated2 = setFrontmatterSlack(readEntry(path128), value);
|
|
32317
|
+
if (updated2 === null) fail7(`${path128} has no YAML frontmatter`);
|
|
32318
|
+
writeFileSync34(path128, updated2);
|
|
32319
|
+
console.log(chalk168.green(`Recorded slack: ${value} in ${path128}`));
|
|
32320
32320
|
}
|
|
32321
32321
|
|
|
32322
32322
|
// src/commands/devlog/skip.ts
|
|
@@ -32443,7 +32443,7 @@ async function previewSlackThreadParts({
|
|
|
32443
32443
|
`Approved for ${target}. The ${bodies.length} bodies to post, in thread order, are at:`
|
|
32444
32444
|
);
|
|
32445
32445
|
paths.forEach(
|
|
32446
|
-
(
|
|
32446
|
+
(path128, index3) => console.log(`${index3 + 1}/${paths.length} ${path128}`)
|
|
32447
32447
|
);
|
|
32448
32448
|
console.log(
|
|
32449
32449
|
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.`
|
|
@@ -32504,10 +32504,10 @@ function devlogSlackChannel() {
|
|
|
32504
32504
|
import { readFileSync as readFileSync52 } from "fs";
|
|
32505
32505
|
import { parse as parseYaml4 } from "yaml";
|
|
32506
32506
|
var FRONTMATTER2 = /^---\n([\s\S]*?)\n---\n?([\s\S]*)$/;
|
|
32507
|
-
function readDevEntryFile(
|
|
32507
|
+
function readDevEntryFile(path128) {
|
|
32508
32508
|
let contents;
|
|
32509
32509
|
try {
|
|
32510
|
-
contents = readFileSync52(
|
|
32510
|
+
contents = readFileSync52(path128, "utf8");
|
|
32511
32511
|
} catch {
|
|
32512
32512
|
return null;
|
|
32513
32513
|
}
|
|
@@ -32645,9 +32645,9 @@ async function slack2(week) {
|
|
|
32645
32645
|
}
|
|
32646
32646
|
if (!isValidWeek(week)) fail8("Invalid week. Use YYYY-Www (e.g. 2026-W33)");
|
|
32647
32647
|
const channel = devlogSlackChannel();
|
|
32648
|
-
const
|
|
32649
|
-
const entry = readDevEntryFile(
|
|
32650
|
-
if (!entry) fail8(`No dev entry for ${week} at ${
|
|
32648
|
+
const path128 = devEntryPath(repoName, week, devDir);
|
|
32649
|
+
const entry = readDevEntryFile(path128);
|
|
32650
|
+
if (!entry) fail8(`No dev entry for ${week} at ${path128}`);
|
|
32651
32651
|
if (entry.slack) fail8(`${week} is already posted: slack: ${entry.slack}`);
|
|
32652
32652
|
const parts2 = renderDevlogSlackParts(
|
|
32653
32653
|
entry,
|
|
@@ -32757,10 +32757,10 @@ async function write() {
|
|
|
32757
32757
|
}
|
|
32758
32758
|
const devDir = resolveDevDir();
|
|
32759
32759
|
const repoName = getRepoName();
|
|
32760
|
-
const
|
|
32761
|
-
mkdirSync26(dirname36(
|
|
32762
|
-
writeFileSync38(
|
|
32763
|
-
console.log(chalk171.green(`Wrote ${
|
|
32760
|
+
const path128 = devEntryPath(repoName, result.data.week, devDir);
|
|
32761
|
+
mkdirSync26(dirname36(path128), { recursive: true });
|
|
32762
|
+
writeFileSync38(path128, formatDevEntry(repoName, result.data));
|
|
32763
|
+
console.log(chalk171.green(`Wrote ${path128}`));
|
|
32764
32764
|
}
|
|
32765
32765
|
|
|
32766
32766
|
// src/commands/devlog/registerDevlogEntryCommands.ts
|
|
@@ -32966,10 +32966,10 @@ function isPositiveInteger(value) {
|
|
|
32966
32966
|
return Number.isInteger(value) && value > 0;
|
|
32967
32967
|
}
|
|
32968
32968
|
function readDocsUnlockPinState(pin2) {
|
|
32969
|
-
const
|
|
32970
|
-
if (!existsSync66(
|
|
32969
|
+
const path128 = getDocsUnlockPinPath(pin2);
|
|
32970
|
+
if (!existsSync66(path128)) return void 0;
|
|
32971
32971
|
try {
|
|
32972
|
-
const state = JSON.parse(readFileSync53(
|
|
32972
|
+
const state = JSON.parse(readFileSync53(path128, "utf8"));
|
|
32973
32973
|
if (state.pin !== pin2) return void 0;
|
|
32974
32974
|
if (!isPositiveInteger(state.itemId)) return void 0;
|
|
32975
32975
|
if (!isPositiveInteger(state.phase)) return void 0;
|
|
@@ -33023,15 +33023,15 @@ async function issueUnlockPin({
|
|
|
33023
33023
|
const pin2 = randomInt2(0, 1e3).toString().padStart(3, "0");
|
|
33024
33024
|
mkdirSync27(getRestrictedDir(), { recursive: true });
|
|
33025
33025
|
sweepRestrictedDir();
|
|
33026
|
-
const
|
|
33027
|
-
writeFileSync39(
|
|
33026
|
+
const path128 = pinPath(pin2);
|
|
33027
|
+
writeFileSync39(path128, JSON.stringify({ ...state, pin: pin2 }));
|
|
33028
33028
|
const delivery = await deliverPinNotification({
|
|
33029
33029
|
area,
|
|
33030
33030
|
pin: pin2,
|
|
33031
33031
|
title: `assist ${area} unlock: ${label}`,
|
|
33032
33032
|
message: `Pin ${pin2} \u2014 run: assist ${area} confirm ${pin2}`
|
|
33033
33033
|
});
|
|
33034
|
-
if (!delivery.delivered) unlinkSync11(
|
|
33034
|
+
if (!delivery.delivered) unlinkSync11(path128);
|
|
33035
33035
|
return delivery;
|
|
33036
33036
|
}
|
|
33037
33037
|
|
|
@@ -33129,10 +33129,10 @@ async function approveItemPhase({
|
|
|
33129
33129
|
}
|
|
33130
33130
|
function approveSession({ harness, conversationId }) {
|
|
33131
33131
|
const scope = { harness, conversationId };
|
|
33132
|
-
const
|
|
33133
|
-
if (!
|
|
33132
|
+
const path128 = getSchemaSessionApprovalPath(scope);
|
|
33133
|
+
if (!path128) return;
|
|
33134
33134
|
mkdirSync28(getSchemaSessionApprovalDir(), { recursive: true });
|
|
33135
|
-
writeFileSync40(
|
|
33135
|
+
writeFileSync40(path128, JSON.stringify(scope));
|
|
33136
33136
|
console.log(
|
|
33137
33137
|
chalk177.green(
|
|
33138
33138
|
`Approved schema changes for ${schemaHarnessLabel(harness)} session ${conversationId}. It may edit and commit database schema files until the session ends.`
|
|
@@ -33175,10 +33175,10 @@ function toState(raw) {
|
|
|
33175
33175
|
return sessionState(raw);
|
|
33176
33176
|
}
|
|
33177
33177
|
function readSchemaUnlockPinState(pin2) {
|
|
33178
|
-
const
|
|
33179
|
-
if (!existsSync67(
|
|
33178
|
+
const path128 = getSchemaUnlockPinPath(pin2);
|
|
33179
|
+
if (!existsSync67(path128)) return void 0;
|
|
33180
33180
|
try {
|
|
33181
|
-
const raw = JSON.parse(readFileSync54(
|
|
33181
|
+
const raw = JSON.parse(readFileSync54(path128, "utf8"));
|
|
33182
33182
|
if (raw.pin !== pin2) return void 0;
|
|
33183
33183
|
return toState(raw);
|
|
33184
33184
|
} catch {
|
|
@@ -35555,8 +35555,8 @@ function collectLabels(value, previous) {
|
|
|
35555
35555
|
import { extname as extname3 } from "path";
|
|
35556
35556
|
|
|
35557
35557
|
// src/commands/prs/screenshotReference.ts
|
|
35558
|
-
function screenshotReference({ path:
|
|
35559
|
-
const target = /\s/.test(
|
|
35558
|
+
function screenshotReference({ path: path128, alt }) {
|
|
35559
|
+
const target = /\s/.test(path128) ? `<${path128}>` : path128;
|
|
35560
35560
|
return ``;
|
|
35561
35561
|
}
|
|
35562
35562
|
|
|
@@ -36013,7 +36013,7 @@ async function reviewProposedIssue(title, body, metadata2 = []) {
|
|
|
36013
36013
|
|
|
36014
36014
|
// src/commands/prs/attachArgs.ts
|
|
36015
36015
|
function attachArgs(attachments) {
|
|
36016
|
-
return attachments.flatMap(({ path:
|
|
36016
|
+
return attachments.flatMap(({ path: path128 }) => ["--attach", path128]);
|
|
36017
36017
|
}
|
|
36018
36018
|
|
|
36019
36019
|
// src/commands/prs/runGhWithAttachments.ts
|
|
@@ -36024,8 +36024,8 @@ import { basename as basename20 } from "path";
|
|
|
36024
36024
|
import { rmSync as rmSync5 } from "fs";
|
|
36025
36025
|
import { dirname as dirname38 } from "path";
|
|
36026
36026
|
function removeStagedAttachments(attachments) {
|
|
36027
|
-
for (const { path:
|
|
36028
|
-
const dir = dirname38(
|
|
36027
|
+
for (const { path: path128 } of attachments) {
|
|
36028
|
+
const dir = dirname38(path128);
|
|
36029
36029
|
if (!isStagedAttachmentPath(dir)) continue;
|
|
36030
36030
|
rmSync5(dir, { recursive: true, force: true });
|
|
36031
36031
|
}
|
|
@@ -36035,7 +36035,7 @@ function removeStagedAttachments(attachments) {
|
|
|
36035
36035
|
var PLACED_URL = /https:\/\/\S+\/(pull|issues)\/\d+/;
|
|
36036
36036
|
function reportPartialFailure(attachments, stderr) {
|
|
36037
36037
|
const failed3 = attachments.filter(
|
|
36038
|
-
({ path:
|
|
36038
|
+
({ path: path128 }) => stderr.includes(path128) || stderr.includes(basename20(path128))
|
|
36039
36039
|
);
|
|
36040
36040
|
const named = failed3.length > 0 ? failed3 : attachments;
|
|
36041
36041
|
console.error(
|
|
@@ -37414,13 +37414,13 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
|
37414
37414
|
const registered = new Set(listWorktreePaths(clone));
|
|
37415
37415
|
const branches = new Set(listLocalBranches(clone));
|
|
37416
37416
|
const isTaken = (candidate) => registered.has(candidate) || existsSync72(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename22(candidate));
|
|
37417
|
-
const
|
|
37418
|
-
const ready = addWorktree(clone,
|
|
37417
|
+
const path128 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
|
|
37418
|
+
const ready = addWorktree(clone, path128, strategy.trunk);
|
|
37419
37419
|
ready.catch(() => {
|
|
37420
37420
|
});
|
|
37421
|
-
return { path:
|
|
37421
|
+
return { path: path128, ready };
|
|
37422
37422
|
}
|
|
37423
|
-
async function addWorktree(clone,
|
|
37423
|
+
async function addWorktree(clone, path128, trunk) {
|
|
37424
37424
|
const fetched = await gitResult(
|
|
37425
37425
|
clone,
|
|
37426
37426
|
["fetch", "--quiet"],
|
|
@@ -37436,13 +37436,13 @@ async function addWorktree(clone, path126, trunk) {
|
|
|
37436
37436
|
"add",
|
|
37437
37437
|
start2.track ? "--track" : "--no-track",
|
|
37438
37438
|
"-b",
|
|
37439
|
-
basename22(
|
|
37440
|
-
|
|
37439
|
+
basename22(path128),
|
|
37440
|
+
path128,
|
|
37441
37441
|
start2.ref
|
|
37442
37442
|
]);
|
|
37443
|
-
recordWorktree(
|
|
37443
|
+
recordWorktree(path128, clone, getCachedOrigin(clone));
|
|
37444
37444
|
daemonLog(
|
|
37445
|
-
start2.track ? `worktree allocated ${
|
|
37445
|
+
start2.track ? `worktree allocated ${path128} (branch ${basename22(path128)} tracking ${start2.ref}) for clone ${clone}` : `worktree allocated ${path128} (branch ${basename22(path128)} off ${start2.ref}, no mainline tracking) for clone ${clone}`
|
|
37446
37446
|
);
|
|
37447
37447
|
}
|
|
37448
37448
|
|
|
@@ -37487,16 +37487,16 @@ function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
|
|
|
37487
37487
|
`worktree.enabled is off for ${repoRoot3}, so every session shares this tree`
|
|
37488
37488
|
);
|
|
37489
37489
|
const clone = canonicalTreePath(mainWorktree(repoRoot3) ?? repoRoot3);
|
|
37490
|
-
const { path:
|
|
37490
|
+
const { path: path128, ready } = createWorktree(
|
|
37491
37491
|
clone,
|
|
37492
37492
|
{ root: cfg.root, trunk: cfg.trunk },
|
|
37493
37493
|
boundTreeRoots2,
|
|
37494
37494
|
options2.replacesTree
|
|
37495
37495
|
);
|
|
37496
37496
|
daemonLog(
|
|
37497
|
-
`session spilled out of the clone ${clone} into ${
|
|
37497
|
+
`session spilled out of the clone ${clone} into ${path128}: worktree.enabled is on, so every session gets its own worktree`
|
|
37498
37498
|
);
|
|
37499
|
-
return { cwd:
|
|
37499
|
+
return { cwd: path128, kind: "worktree", created: true, clone, ready };
|
|
37500
37500
|
}
|
|
37501
37501
|
|
|
37502
37502
|
// src/commands/sessions/daemon/describePersistedSession.ts
|
|
@@ -38033,12 +38033,12 @@ async function reportCwdToDaemon(cwd) {
|
|
|
38033
38033
|
|
|
38034
38034
|
// src/commands/sessions/daemon/worktree/worktreeWithBranch.ts
|
|
38035
38035
|
function worktreeWithBranch(listing, branch2) {
|
|
38036
|
-
let
|
|
38036
|
+
let path128 = null;
|
|
38037
38037
|
for (const line of listing.split("\n")) {
|
|
38038
38038
|
const trimmed = line.trim();
|
|
38039
38039
|
if (trimmed.startsWith("worktree "))
|
|
38040
|
-
|
|
38041
|
-
else if (trimmed === `branch refs/heads/${branch2}`) return
|
|
38040
|
+
path128 = trimmed.slice("worktree ".length).trim();
|
|
38041
|
+
else if (trimmed === `branch refs/heads/${branch2}`) return path128;
|
|
38042
38042
|
}
|
|
38043
38043
|
return null;
|
|
38044
38044
|
}
|
|
@@ -38048,8 +38048,8 @@ function worktreeHoldingBranch(cwd, branch2) {
|
|
|
38048
38048
|
const listing = gitSyncOrNull(cwd, ["worktree", "list", "--porcelain"]);
|
|
38049
38049
|
if (!listing) return null;
|
|
38050
38050
|
const here = gitSyncOrNull(cwd, ["rev-parse", "--show-toplevel"]);
|
|
38051
|
-
const
|
|
38052
|
-
return
|
|
38051
|
+
const path128 = worktreeWithBranch(listing, branch2);
|
|
38052
|
+
return path128 && path128 !== here ? path128 : null;
|
|
38053
38053
|
}
|
|
38054
38054
|
|
|
38055
38055
|
// src/commands/review/failCheckout.ts
|
|
@@ -39271,9 +39271,9 @@ function parseRscRows(flight) {
|
|
|
39271
39271
|
}
|
|
39272
39272
|
function makeRscResolver(rows) {
|
|
39273
39273
|
return (ref) => {
|
|
39274
|
-
const [id, ...
|
|
39274
|
+
const [id, ...path128] = ref.slice(1).replace(/^[L@]/, "").split(":");
|
|
39275
39275
|
let v = rows[id];
|
|
39276
|
-
for (const key of
|
|
39276
|
+
for (const key of path128) {
|
|
39277
39277
|
if (v == null || typeof v !== "object") return void 0;
|
|
39278
39278
|
v = v[key];
|
|
39279
39279
|
}
|
|
@@ -40062,18 +40062,18 @@ function validateLine(line) {
|
|
|
40062
40062
|
process.exit(1);
|
|
40063
40063
|
}
|
|
40064
40064
|
}
|
|
40065
|
-
async function comment2(
|
|
40065
|
+
async function comment2(path128, line, body, options2 = {}) {
|
|
40066
40066
|
const { startLine, skipPreview } = options2;
|
|
40067
40067
|
validateBody(body);
|
|
40068
40068
|
validateLine(line);
|
|
40069
40069
|
if (startLine !== void 0) validateLine(startLine);
|
|
40070
40070
|
const range = startLine !== void 0 ? `${startLine}-${line}` : `${line}`;
|
|
40071
40071
|
if (!skipPreview)
|
|
40072
|
-
await reviewProposedPrComment(`Comment on ${
|
|
40072
|
+
await reviewProposedPrComment(`Comment on ${path128}:${range}`, body, null);
|
|
40073
40073
|
try {
|
|
40074
40074
|
const prId = getCurrentPrNodeId();
|
|
40075
|
-
postReviewComment({ prId, body, path:
|
|
40076
|
-
console.log(`Added review comment on ${
|
|
40075
|
+
postReviewComment({ prId, body, path: path128, line, startLine });
|
|
40076
|
+
console.log(`Added review comment on ${path128}:${range}`);
|
|
40077
40077
|
} catch (error) {
|
|
40078
40078
|
if (isGhNotInstalled(error)) {
|
|
40079
40079
|
console.error("Error: GitHub CLI (gh) is not installed.");
|
|
@@ -40912,9 +40912,9 @@ function registerPrsComments(prsCommand) {
|
|
|
40912
40912
|
internalCommand(
|
|
40913
40913
|
prsCommand.command("comment <path> <line> <body>").description(
|
|
40914
40914
|
"Add a line comment to the pending review (body of - reads it from stdin)"
|
|
40915
|
-
).action(async (
|
|
40915
|
+
).action(async (path128, line, body) => {
|
|
40916
40916
|
await comment2(
|
|
40917
|
-
|
|
40917
|
+
path128,
|
|
40918
40918
|
Number.parseInt(line, 10),
|
|
40919
40919
|
await readBodyArgument(body)
|
|
40920
40920
|
);
|
|
@@ -41042,9 +41042,9 @@ function splitOnce(value, separator) {
|
|
|
41042
41042
|
if (index3 === -1) return null;
|
|
41043
41043
|
return [value.slice(0, index3), value.slice(index3 + separator.length)];
|
|
41044
41044
|
}
|
|
41045
|
-
function isFile2(
|
|
41045
|
+
function isFile2(path128) {
|
|
41046
41046
|
try {
|
|
41047
|
-
return statSync13(
|
|
41047
|
+
return statSync13(path128).isFile();
|
|
41048
41048
|
} catch {
|
|
41049
41049
|
return false;
|
|
41050
41050
|
}
|
|
@@ -41052,16 +41052,16 @@ function isFile2(path126) {
|
|
|
41052
41052
|
function parseScreenshotSpec(spec) {
|
|
41053
41053
|
const [label, rawPath] = splitOnce(spec, "=") ?? ["", spec];
|
|
41054
41054
|
const [group, caption] = splitOnce(label, "/") ?? ["", label];
|
|
41055
|
-
const
|
|
41056
|
-
const ext = extname5(
|
|
41057
|
-
if (!isFile2(
|
|
41058
|
-
throw new Error(`--screenshot '${spec}': file not found: ${
|
|
41055
|
+
const path128 = resolve27(rawPath.trim());
|
|
41056
|
+
const ext = extname5(path128).replace(/^\./, "").toLowerCase();
|
|
41057
|
+
if (!isFile2(path128))
|
|
41058
|
+
throw new Error(`--screenshot '${spec}': file not found: ${path128}`);
|
|
41059
41059
|
if (!ghAttachableExtensions.has(ext))
|
|
41060
41060
|
throw new Error(
|
|
41061
41061
|
`--screenshot '${spec}': gh cannot attach .${ext || "(none)"} files (supported: ${[...ghAttachableExtensions].join(", ")}).`
|
|
41062
41062
|
);
|
|
41063
|
-
const alt = caption.trim() || basename24(
|
|
41064
|
-
return group.trim() ? { path:
|
|
41063
|
+
const alt = caption.trim() || basename24(path128, extname5(path128));
|
|
41064
|
+
return group.trim() ? { path: path128, alt, group: group.trim() } : { path: path128, alt };
|
|
41065
41065
|
}
|
|
41066
41066
|
|
|
41067
41067
|
// src/commands/prs/parseScreenshotSpecs.ts
|
|
@@ -42236,11 +42236,11 @@ async function loadBody(target) {
|
|
|
42236
42236
|
if (target.kind === "file") return readDraftFile(target.path);
|
|
42237
42237
|
return fetchPrBody(target.number, target.repo);
|
|
42238
42238
|
}
|
|
42239
|
-
function readDraftFile(
|
|
42239
|
+
function readDraftFile(path128) {
|
|
42240
42240
|
try {
|
|
42241
|
-
return readFileSync64(
|
|
42241
|
+
return readFileSync64(path128, "utf8");
|
|
42242
42242
|
} catch {
|
|
42243
|
-
console.error(`Error: Could not read \`${
|
|
42243
|
+
console.error(`Error: Could not read \`${path128}\`.`);
|
|
42244
42244
|
console.error(
|
|
42245
42245
|
"Pass a pull request number, a GitHub pull request URL, - for stdin, or a path to a file."
|
|
42246
42246
|
);
|
|
@@ -42520,10 +42520,10 @@ function resolveOpSecret(reference) {
|
|
|
42520
42520
|
}
|
|
42521
42521
|
|
|
42522
42522
|
// src/commands/ravendb/ravenFetch.ts
|
|
42523
|
-
async function ravenFetch(connection,
|
|
42523
|
+
async function ravenFetch(connection, path128) {
|
|
42524
42524
|
const apiKey = resolveOpSecret(connection.apiKeyRef);
|
|
42525
42525
|
let accessToken = await getAccessToken(apiKey);
|
|
42526
|
-
const url = `${connection.url}${
|
|
42526
|
+
const url = `${connection.url}${path128}`;
|
|
42527
42527
|
const headers = {
|
|
42528
42528
|
Authorization: `Bearer ${accessToken}`,
|
|
42529
42529
|
"Content-Type": "application/json"
|
|
@@ -42613,16 +42613,16 @@ import chalk230 from "chalk";
|
|
|
42613
42613
|
// src/commands/ravendb/buildQueryPath.ts
|
|
42614
42614
|
function buildQueryPath(opts) {
|
|
42615
42615
|
const db = encodeURIComponent(opts.db);
|
|
42616
|
-
let
|
|
42616
|
+
let path128;
|
|
42617
42617
|
if (opts.collection) {
|
|
42618
|
-
|
|
42618
|
+
path128 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
|
|
42619
42619
|
} else {
|
|
42620
|
-
|
|
42620
|
+
path128 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
|
|
42621
42621
|
}
|
|
42622
42622
|
if (opts.query) {
|
|
42623
|
-
|
|
42623
|
+
path128 += `&query=${encodeURIComponent(opts.query)}`;
|
|
42624
42624
|
}
|
|
42625
|
-
return
|
|
42625
|
+
return path128;
|
|
42626
42626
|
}
|
|
42627
42627
|
|
|
42628
42628
|
// src/commands/ravendb/fetchAllPages.ts
|
|
@@ -42631,7 +42631,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
42631
42631
|
let start2 = 0;
|
|
42632
42632
|
while (true) {
|
|
42633
42633
|
const effectivePageSize = opts.limit !== void 0 ? Math.min(opts.pageSize, opts.limit - allResults.length) : opts.pageSize;
|
|
42634
|
-
const
|
|
42634
|
+
const path128 = buildQueryPath({
|
|
42635
42635
|
db: connection.database,
|
|
42636
42636
|
collection: opts.collection,
|
|
42637
42637
|
start: start2,
|
|
@@ -42639,7 +42639,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
42639
42639
|
sort: opts.sort,
|
|
42640
42640
|
query: opts.query
|
|
42641
42641
|
});
|
|
42642
|
-
const data = await ravenFetch(connection,
|
|
42642
|
+
const data = await ravenFetch(connection, path128);
|
|
42643
42643
|
const results = data.Results ?? [];
|
|
42644
42644
|
const totalResults = data.TotalResults ?? 0;
|
|
42645
42645
|
if (results.length === 0) break;
|
|
@@ -45680,8 +45680,8 @@ function displayLongPaths(longPaths, maxPathLength) {
|
|
|
45680
45680
|
Plan exceeds restructure.maxPathLength ${maxPathLength}: ${longPaths.length} repo-relative path(s) longer.`
|
|
45681
45681
|
)
|
|
45682
45682
|
);
|
|
45683
|
-
for (const { path:
|
|
45684
|
-
console.log(` ${
|
|
45683
|
+
for (const { path: path128, length } of longPaths)
|
|
45684
|
+
console.log(` ${path128} [${length}]`);
|
|
45685
45685
|
}
|
|
45686
45686
|
|
|
45687
45687
|
// src/commands/refactor/restructure/displayLayoutLimits.ts
|
|
@@ -46397,8 +46397,8 @@ function groupFilesByDirectory(files) {
|
|
|
46397
46397
|
}
|
|
46398
46398
|
|
|
46399
46399
|
// src/commands/review/highLevel/buildHighLevelTree.ts
|
|
46400
|
-
function basename26(
|
|
46401
|
-
return
|
|
46400
|
+
function basename26(path128) {
|
|
46401
|
+
return path128.slice(path128.lastIndexOf("/") + 1);
|
|
46402
46402
|
}
|
|
46403
46403
|
function sum(nodes, key) {
|
|
46404
46404
|
return nodes.reduce((total2, node) => total2 + node[key], 0);
|
|
@@ -46419,19 +46419,19 @@ function nodesOf(at2, prefix2) {
|
|
|
46419
46419
|
}
|
|
46420
46420
|
function collapsedDirNode(name2, at2, prefix2) {
|
|
46421
46421
|
let label = name2;
|
|
46422
|
-
let
|
|
46422
|
+
let path128 = prefix2 ? `${prefix2}/${name2}` : name2;
|
|
46423
46423
|
let node = at2;
|
|
46424
46424
|
while (node.files.length === 0 && node.dirs.size === 1) {
|
|
46425
46425
|
const [childName, child2] = [...node.dirs][0];
|
|
46426
46426
|
label = `${label}/${childName}`;
|
|
46427
|
-
|
|
46427
|
+
path128 = `${path128}/${childName}`;
|
|
46428
46428
|
node = child2;
|
|
46429
46429
|
}
|
|
46430
|
-
const children = nodesOf(node,
|
|
46430
|
+
const children = nodesOf(node, path128);
|
|
46431
46431
|
return {
|
|
46432
46432
|
kind: "dir",
|
|
46433
46433
|
name: label,
|
|
46434
|
-
path:
|
|
46434
|
+
path: path128,
|
|
46435
46435
|
additions: sum(children, "additions"),
|
|
46436
46436
|
deletions: sum(children, "deletions"),
|
|
46437
46437
|
children
|
|
@@ -46736,8 +46736,8 @@ function toStatus(status2) {
|
|
|
46736
46736
|
if (status2 === "removed") return "removed";
|
|
46737
46737
|
return "modified";
|
|
46738
46738
|
}
|
|
46739
|
-
function diffUrl(repo, prNumber,
|
|
46740
|
-
const anchor = createHash4("sha256").update(
|
|
46739
|
+
function diffUrl(repo, prNumber, path128) {
|
|
46740
|
+
const anchor = createHash4("sha256").update(path128).digest("hex");
|
|
46741
46741
|
return `https://github.com/${repo}/pull/${prNumber}/files#diff-${anchor}`;
|
|
46742
46742
|
}
|
|
46743
46743
|
function fetchHighLevelFiles(prNumber, repo) {
|
|
@@ -46927,10 +46927,10 @@ function listHighLevelHunks(files) {
|
|
|
46927
46927
|
|
|
46928
46928
|
// src/commands/review/highLevel/readJsonFile.ts
|
|
46929
46929
|
import { existsSync as existsSync78, readFileSync as readFileSync67 } from "fs";
|
|
46930
|
-
function readJsonFile(
|
|
46931
|
-
if (!existsSync78(
|
|
46930
|
+
function readJsonFile(path128) {
|
|
46931
|
+
if (!existsSync78(path128)) return void 0;
|
|
46932
46932
|
try {
|
|
46933
|
-
return JSON.parse(readFileSync67(
|
|
46933
|
+
return JSON.parse(readFileSync67(path128, "utf8"));
|
|
46934
46934
|
} catch {
|
|
46935
46935
|
return void 0;
|
|
46936
46936
|
}
|
|
@@ -47011,11 +47011,11 @@ function resolveHighLevelSlices(raw, hunks) {
|
|
|
47011
47011
|
// src/commands/review/highLevel/writeJsonFile.ts
|
|
47012
47012
|
import { mkdirSync as mkdirSync35, writeFileSync as writeFileSync49 } from "fs";
|
|
47013
47013
|
import { dirname as dirname47 } from "path";
|
|
47014
|
-
function writeJsonFile(
|
|
47015
|
-
mkdirSync35(dirname47(
|
|
47016
|
-
writeFileSync49(
|
|
47014
|
+
function writeJsonFile(path128, data) {
|
|
47015
|
+
mkdirSync35(dirname47(path128), { recursive: true });
|
|
47016
|
+
writeFileSync49(path128, `${JSON.stringify(data, null, 2)}
|
|
47017
47017
|
`);
|
|
47018
|
-
return
|
|
47018
|
+
return path128;
|
|
47019
47019
|
}
|
|
47020
47020
|
|
|
47021
47021
|
// src/commands/review/highLevel/gatherHighLevelSlices.ts
|
|
@@ -47028,23 +47028,23 @@ function readSlicesFile(file) {
|
|
|
47028
47028
|
);
|
|
47029
47029
|
}
|
|
47030
47030
|
}
|
|
47031
|
-
function sliceFromFile(file, files,
|
|
47031
|
+
function sliceFromFile(file, files, path128) {
|
|
47032
47032
|
const { warnings, ...set } = resolveHighLevelSlices(
|
|
47033
47033
|
readSlicesFile(file),
|
|
47034
47034
|
listHighLevelHunks(files)
|
|
47035
47035
|
);
|
|
47036
47036
|
for (const warning of warnings) console.warn(`Warning: ${warning}`);
|
|
47037
|
-
writeJsonFile(
|
|
47037
|
+
writeJsonFile(path128, set);
|
|
47038
47038
|
return set;
|
|
47039
47039
|
}
|
|
47040
|
-
function readSavedSlices(
|
|
47041
|
-
const saved = readJsonFile(
|
|
47040
|
+
function readSavedSlices(path128) {
|
|
47041
|
+
const saved = readJsonFile(path128);
|
|
47042
47042
|
return Array.isArray(saved) ? { slices: saved } : saved;
|
|
47043
47043
|
}
|
|
47044
47044
|
function gatherHighLevelSlices(head, files, slicing) {
|
|
47045
|
-
const
|
|
47046
|
-
if (slicing.slicesFile) return sliceFromFile(slicing.slicesFile, files,
|
|
47047
|
-
const saved = slicing.force ? void 0 : readSavedSlices(
|
|
47045
|
+
const path128 = highLevelSlicesPath(head.repo, head.headRef, head.headSha);
|
|
47046
|
+
if (slicing.slicesFile) return sliceFromFile(slicing.slicesFile, files, path128);
|
|
47047
|
+
const saved = slicing.force ? void 0 : readSavedSlices(path128);
|
|
47048
47048
|
if (saved) return saved;
|
|
47049
47049
|
console.log(formatSlicingRequest(listHighLevelHunks(files)));
|
|
47050
47050
|
process.exit(2);
|
|
@@ -47226,13 +47226,13 @@ function visit(node, context) {
|
|
|
47226
47226
|
}
|
|
47227
47227
|
];
|
|
47228
47228
|
}
|
|
47229
|
-
function extractTestHierarchy(
|
|
47229
|
+
function extractTestHierarchy(path128, text18, changed) {
|
|
47230
47230
|
const project = new Project5({
|
|
47231
47231
|
useInMemoryFileSystem: true,
|
|
47232
47232
|
compilerOptions: { allowJs: true }
|
|
47233
47233
|
});
|
|
47234
|
-
const source = project.createSourceFile(`/${
|
|
47235
|
-
return collect7(source, { path:
|
|
47234
|
+
const source = project.createSourceFile(`/${path128}`, text18);
|
|
47235
|
+
return collect7(source, { path: path128, ...changed ? { changed } : {} });
|
|
47236
47236
|
}
|
|
47237
47237
|
|
|
47238
47238
|
// src/commands/review/highLevel/patchAddedLines.ts
|
|
@@ -47254,8 +47254,8 @@ function testFile(file, readSource4) {
|
|
|
47254
47254
|
const changed = file.patch === void 0 ? void 0 : patchAddedLines(file.patch);
|
|
47255
47255
|
const tests = extractTestHierarchy(file.path, readSource4(file.path), changed);
|
|
47256
47256
|
if (tests.length === 0) return [];
|
|
47257
|
-
const { path:
|
|
47258
|
-
return [{ path:
|
|
47257
|
+
const { path: path128, status: status2, additions, deletions, diffUrl: diffUrl2 } = file;
|
|
47258
|
+
return [{ path: path128, status: status2, additions, deletions, diffUrl: diffUrl2, tests }];
|
|
47259
47259
|
}
|
|
47260
47260
|
function collectHighLevelTests(files, testPaths, readSource4) {
|
|
47261
47261
|
return files.filter(
|
|
@@ -47265,8 +47265,8 @@ function collectHighLevelTests(files, testPaths, readSource4) {
|
|
|
47265
47265
|
|
|
47266
47266
|
// src/commands/review/highLevel/fetchFileAtSha.ts
|
|
47267
47267
|
import { execFileSync as execFileSync29 } from "child_process";
|
|
47268
|
-
function fetchFileAtSha(repo, sha,
|
|
47269
|
-
const encodedPath =
|
|
47268
|
+
function fetchFileAtSha(repo, sha, path128) {
|
|
47269
|
+
const encodedPath = path128.split("/").map(encodeURIComponent).join("/");
|
|
47270
47270
|
try {
|
|
47271
47271
|
return execFileSync29(
|
|
47272
47272
|
"gh",
|
|
@@ -47284,7 +47284,7 @@ function fetchFileAtSha(repo, sha, path126) {
|
|
|
47284
47284
|
);
|
|
47285
47285
|
} catch (error) {
|
|
47286
47286
|
throw new Error(
|
|
47287
|
-
`Could not read ${
|
|
47287
|
+
`Could not read ${path128} at PR head ${sha.slice(0, 7)}: ${ghFailure(error)}`
|
|
47288
47288
|
);
|
|
47289
47289
|
}
|
|
47290
47290
|
}
|
|
@@ -47295,7 +47295,7 @@ function gatherHighLevelTests(files, testPaths, repo, headSha) {
|
|
|
47295
47295
|
collectHighLevelTests(
|
|
47296
47296
|
files,
|
|
47297
47297
|
testPaths,
|
|
47298
|
-
(
|
|
47298
|
+
(path128) => fetchFileAtSha(repo, headSha, path128)
|
|
47299
47299
|
)
|
|
47300
47300
|
);
|
|
47301
47301
|
}
|
|
@@ -47333,8 +47333,8 @@ import { minimatch as minimatch9 } from "minimatch";
|
|
|
47333
47333
|
function selectCriticalDiffs(files, criticalPaths) {
|
|
47334
47334
|
if (criticalPaths.length === 0) return [];
|
|
47335
47335
|
return files.filter((file) => criticalPaths.some((glob) => minimatch9(file.path, glob))).map(
|
|
47336
|
-
({ path:
|
|
47337
|
-
path:
|
|
47336
|
+
({ path: path128, status: status2, additions, deletions, diffUrl: diffUrl2, patch: patch2, truncated }) => ({
|
|
47337
|
+
path: path128,
|
|
47338
47338
|
status: status2,
|
|
47339
47339
|
additions,
|
|
47340
47340
|
deletions,
|
|
@@ -47539,14 +47539,14 @@ function saveHighLevelReview(record3) {
|
|
|
47539
47539
|
|
|
47540
47540
|
// src/commands/review/highLevel/formatReviewComment.ts
|
|
47541
47541
|
function formatReviewComment({
|
|
47542
|
-
path:
|
|
47542
|
+
path: path128,
|
|
47543
47543
|
startLine,
|
|
47544
47544
|
endLine,
|
|
47545
47545
|
quote,
|
|
47546
47546
|
note
|
|
47547
47547
|
}) {
|
|
47548
47548
|
const lines = startLine === endLine ? `${startLine}` : `${startLine}-${endLine}`;
|
|
47549
|
-
return `- \`${
|
|
47549
|
+
return `- \`${path128}:${lines}\` ${quote}: ${note.replace(/\n/g, "\n ")}`;
|
|
47550
47550
|
}
|
|
47551
47551
|
|
|
47552
47552
|
// src/commands/review/highLevel/formatHighLevelReviewBody.ts
|
|
@@ -48895,8 +48895,8 @@ function fetchExistingComments() {
|
|
|
48895
48895
|
// src/commands/review/prepareReviewDir.ts
|
|
48896
48896
|
import { existsSync as existsSync80, mkdirSync as mkdirSync37, unlinkSync as unlinkSync19, writeFileSync as writeFileSync50 } from "fs";
|
|
48897
48897
|
function clearReviewFiles(paths) {
|
|
48898
|
-
for (const
|
|
48899
|
-
if (existsSync80(
|
|
48898
|
+
for (const path128 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
48899
|
+
if (existsSync80(path128)) unlinkSync19(path128);
|
|
48900
48900
|
}
|
|
48901
48901
|
}
|
|
48902
48902
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -50158,8 +50158,8 @@ import chalk284 from "chalk";
|
|
|
50158
50158
|
|
|
50159
50159
|
// src/commands/seq/fetchSeq.ts
|
|
50160
50160
|
import chalk281 from "chalk";
|
|
50161
|
-
async function fetchSeq(conn,
|
|
50162
|
-
const url = `${conn.url}${
|
|
50161
|
+
async function fetchSeq(conn, path128, params) {
|
|
50162
|
+
const url = `${conn.url}${path128}?${params}`;
|
|
50163
50163
|
const response = await fetch(url, {
|
|
50164
50164
|
headers: {
|
|
50165
50165
|
Accept: "application/json",
|
|
@@ -50469,17 +50469,17 @@ import { homedir as homedir28 } from "os";
|
|
|
50469
50469
|
// src/commands/show/findShownSessionFiles.ts
|
|
50470
50470
|
var NOT_AFTER = String.raw`(?![\w\-/]|\.\w)`;
|
|
50471
50471
|
var NOT_BEFORE_RELATIVE = String.raw`(?<=^|[^\w.\-/~]|(?:^|[^\w.\-/~])\./)`;
|
|
50472
|
-
function normalise(
|
|
50473
|
-
return
|
|
50472
|
+
function normalise(path128) {
|
|
50473
|
+
return path128.replaceAll("\\", "/").replace(/\/+$/, "");
|
|
50474
50474
|
}
|
|
50475
50475
|
function escapeRegExp2(text18) {
|
|
50476
50476
|
return text18.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
|
|
50477
50477
|
}
|
|
50478
|
-
function within(
|
|
50479
|
-
return dir &&
|
|
50478
|
+
function within(path128, dir) {
|
|
50479
|
+
return dir && path128.startsWith(`${dir}/`) ? path128.slice(dir.length + 1) : void 0;
|
|
50480
50480
|
}
|
|
50481
|
-
function referencePatterns(
|
|
50482
|
-
const file = normalise(
|
|
50481
|
+
function referencePatterns(path128, { home, cwd }) {
|
|
50482
|
+
const file = normalise(path128);
|
|
50483
50483
|
const forms = [escapeRegExp2(file)];
|
|
50484
50484
|
const drive = /^\/mnt\/([a-z])\/(.+)$/i.exec(file);
|
|
50485
50485
|
if (drive)
|
|
@@ -50499,7 +50499,7 @@ function referencePatterns(path126, { home, cwd }) {
|
|
|
50499
50499
|
function findShownSessionFiles(body, writtenPaths2, locations) {
|
|
50500
50500
|
const text18 = body.replaceAll("\\", "/");
|
|
50501
50501
|
return writtenPaths2.filter(
|
|
50502
|
-
(
|
|
50502
|
+
(path128) => referencePatterns(path128, locations).some((pattern2) => pattern2.test(text18))
|
|
50503
50503
|
);
|
|
50504
50504
|
}
|
|
50505
50505
|
|
|
@@ -50531,7 +50531,7 @@ async function refuseSessionFiles(body) {
|
|
|
50531
50531
|
console.error(
|
|
50532
50532
|
[
|
|
50533
50533
|
"Error: refusing to show files this session created or edited; the user already sees them in the session's diff:",
|
|
50534
|
-
...shown.map((
|
|
50534
|
+
...shown.map((path128) => ` ${path128}`),
|
|
50535
50535
|
"Remove them (and any label or folder entry that exists only for them) and re-run, or skip the show if nothing is left."
|
|
50536
50536
|
].join("\n")
|
|
50537
50537
|
);
|
|
@@ -50912,7 +50912,7 @@ function registerSql(program) {
|
|
|
50912
50912
|
|
|
50913
50913
|
// src/commands/sync.ts
|
|
50914
50914
|
import * as os6 from "os";
|
|
50915
|
-
import * as
|
|
50915
|
+
import * as path124 from "path";
|
|
50916
50916
|
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
50917
50917
|
|
|
50918
50918
|
// src/commands/sync/createSyncFiles.ts
|
|
@@ -51058,6 +51058,9 @@ function createSyncFiles(initial = syncManifest.load()) {
|
|
|
51058
51058
|
};
|
|
51059
51059
|
}
|
|
51060
51060
|
|
|
51061
|
+
// src/commands/sync/pruneClaude.ts
|
|
51062
|
+
import * as path110 from "path";
|
|
51063
|
+
|
|
51061
51064
|
// src/commands/sync/pruneCommands.ts
|
|
51062
51065
|
import * as path108 from "path";
|
|
51063
51066
|
|
|
@@ -51077,7 +51080,7 @@ function pruneEntry(entry, targetDir, keep, shape, options2, result) {
|
|
|
51077
51080
|
return;
|
|
51078
51081
|
}
|
|
51079
51082
|
result.orphans.push(entry.name);
|
|
51080
|
-
const reason4 = shape.blockedBy?.(entryPath);
|
|
51083
|
+
const reason4 = options2.owner.owns(entryPath) ? void 0 : shape.blockedBy?.(entryPath);
|
|
51081
51084
|
if (reason4) {
|
|
51082
51085
|
result.skipped.push({ name: entry.name, reason: reason4 });
|
|
51083
51086
|
return;
|
|
@@ -51124,7 +51127,7 @@ function pruneSkills(targetDir, skillNames, options2) {
|
|
|
51124
51127
|
targetDir,
|
|
51125
51128
|
skillNames,
|
|
51126
51129
|
{
|
|
51127
|
-
nameOf: (entry) => entry.isDirectory() ? entry.name : void 0,
|
|
51130
|
+
nameOf: (entry) => entry.isDirectory() || entry.name.endsWith(".md") ? entry.name : void 0,
|
|
51128
51131
|
ownedPaths: (skillDir) => [skillDir, path109.join(skillDir, "SKILL.md")],
|
|
51129
51132
|
blockedBy: unexpectedContent
|
|
51130
51133
|
},
|
|
@@ -51132,6 +51135,7 @@ function pruneSkills(targetDir, skillNames, options2) {
|
|
|
51132
51135
|
);
|
|
51133
51136
|
}
|
|
51134
51137
|
function unexpectedContent(skillDir) {
|
|
51138
|
+
if (!fs58.statSync(skillDir).isDirectory()) return void 0;
|
|
51135
51139
|
const entries = fs58.readdirSync(skillDir);
|
|
51136
51140
|
const others = entries.filter((entry) => entry !== "SKILL.md");
|
|
51137
51141
|
if (others.length > 0) return `contains ${others.sort().join(", ")}`;
|
|
@@ -51141,13 +51145,13 @@ function unexpectedContent(skillDir) {
|
|
|
51141
51145
|
// src/commands/sync/reportPrune.ts
|
|
51142
51146
|
function reportPrune(label, result, force) {
|
|
51143
51147
|
if (result.orphans.length === 0) {
|
|
51144
|
-
console.log(`No orphaned
|
|
51148
|
+
console.log(`No orphaned files in ${label}`);
|
|
51145
51149
|
} else if (force) {
|
|
51146
51150
|
for (const name2 of result.removed) {
|
|
51147
51151
|
console.log(`Removed ${name2} from ${label}`);
|
|
51148
51152
|
}
|
|
51149
51153
|
} else {
|
|
51150
|
-
console.log(`Orphaned
|
|
51154
|
+
console.log(`Orphaned files in ${label} (run with --force to remove):`);
|
|
51151
51155
|
for (const name2 of result.orphans) {
|
|
51152
51156
|
console.log(` ${name2}`);
|
|
51153
51157
|
}
|
|
@@ -51165,9 +51169,25 @@ function reportPrune(label, result, force) {
|
|
|
51165
51169
|
}
|
|
51166
51170
|
}
|
|
51167
51171
|
|
|
51172
|
+
// src/commands/sync/pruneClaude.ts
|
|
51173
|
+
function pruneClaude(targetBase, skillNames, options2, owner) {
|
|
51174
|
+
if (!options2.prune) return;
|
|
51175
|
+
const force = options2.force ?? false;
|
|
51176
|
+
reportPrune(
|
|
51177
|
+
"~/.claude/skills",
|
|
51178
|
+
pruneSkills(path110.join(targetBase, "skills"), skillNames, { force, owner }),
|
|
51179
|
+
force
|
|
51180
|
+
);
|
|
51181
|
+
reportPrune(
|
|
51182
|
+
"~/.claude/commands",
|
|
51183
|
+
pruneCommands(path110.join(targetBase, "commands"), [], { force, owner }),
|
|
51184
|
+
force
|
|
51185
|
+
);
|
|
51186
|
+
}
|
|
51187
|
+
|
|
51168
51188
|
// src/commands/sync/syncClaudeCommands.ts
|
|
51169
51189
|
import * as fs60 from "fs";
|
|
51170
|
-
import * as
|
|
51190
|
+
import * as path113 from "path";
|
|
51171
51191
|
|
|
51172
51192
|
// src/commands/sync/commandToSkill.ts
|
|
51173
51193
|
function commandToSkill(name2, content) {
|
|
@@ -51186,20 +51206,20 @@ function quoteYaml(value) {
|
|
|
51186
51206
|
|
|
51187
51207
|
// src/commands/sync/markdownNames.ts
|
|
51188
51208
|
import * as fs59 from "fs";
|
|
51189
|
-
import * as
|
|
51209
|
+
import * as path111 from "path";
|
|
51190
51210
|
function markdownNames(dir) {
|
|
51191
|
-
return fs59.readdirSync(dir).filter((file) => file.endsWith(".md")).map((file) =>
|
|
51211
|
+
return fs59.readdirSync(dir).filter((file) => file.endsWith(".md")).map((file) => path111.basename(file, ".md"));
|
|
51192
51212
|
}
|
|
51193
51213
|
|
|
51194
51214
|
// src/commands/sync/renderHarnessPaths.ts
|
|
51195
51215
|
import * as os5 from "os";
|
|
51196
|
-
import * as
|
|
51216
|
+
import * as path112 from "path";
|
|
51197
51217
|
function homePath(harness, dest) {
|
|
51198
|
-
const relative12 =
|
|
51218
|
+
const relative12 = path112.relative(
|
|
51199
51219
|
os5.homedir(),
|
|
51200
|
-
|
|
51220
|
+
path112.join(harness.homeDir, dest)
|
|
51201
51221
|
);
|
|
51202
|
-
return `~/${relative12.split(
|
|
51222
|
+
return `~/${relative12.split(path112.sep).join("/")}`;
|
|
51203
51223
|
}
|
|
51204
51224
|
function renderHarnessPaths(content, harness) {
|
|
51205
51225
|
const { sync: sync2 } = harness;
|
|
@@ -51217,33 +51237,33 @@ function renderHarnessPaths(content, harness) {
|
|
|
51217
51237
|
|
|
51218
51238
|
// src/commands/sync/syncClaudeCommands.ts
|
|
51219
51239
|
function syncClaudeCommands(claudeDir, targetBase, files) {
|
|
51220
|
-
const sourceDir =
|
|
51240
|
+
const sourceDir = path113.join(claudeDir, "commands");
|
|
51221
51241
|
const names = markdownNames(sourceDir);
|
|
51222
51242
|
for (const name2 of names) {
|
|
51223
|
-
const content = fs60.readFileSync(
|
|
51243
|
+
const content = fs60.readFileSync(path113.join(sourceDir, `${name2}.md`), "utf8");
|
|
51224
51244
|
const rendered = renderHarnessPaths(content, harnesses.claude);
|
|
51225
51245
|
files.write(
|
|
51226
|
-
|
|
51246
|
+
path113.join(targetBase, "skills", name2, "SKILL.md"),
|
|
51227
51247
|
commandToSkill(name2, rendered)
|
|
51228
51248
|
);
|
|
51229
|
-
files.remove(
|
|
51249
|
+
files.remove(path113.join(targetBase, "commands", `${name2}.md`), [
|
|
51230
51250
|
content,
|
|
51231
51251
|
rendered
|
|
51232
51252
|
]);
|
|
51233
51253
|
}
|
|
51234
51254
|
console.log(
|
|
51235
|
-
`Synced ${names.length} skill(s) to ${
|
|
51255
|
+
`Synced ${names.length} skill(s) to ${path113.join(targetBase, "skills")}`
|
|
51236
51256
|
);
|
|
51237
51257
|
return names;
|
|
51238
51258
|
}
|
|
51239
51259
|
|
|
51240
51260
|
// src/commands/sync/reportRetiredAgentsFiles.ts
|
|
51241
51261
|
import * as fs61 from "fs";
|
|
51242
|
-
import * as
|
|
51262
|
+
import * as path114 from "path";
|
|
51243
51263
|
var retired = [
|
|
51244
|
-
|
|
51245
|
-
|
|
51246
|
-
|
|
51264
|
+
path114.join(harnesses.claude.homeDir, "CLAUDE.md"),
|
|
51265
|
+
path114.join(harnesses.codex.homeDir, "AGENTS.md"),
|
|
51266
|
+
path114.join(harnesses.pi.homeDir, "AGENTS.md")
|
|
51247
51267
|
];
|
|
51248
51268
|
function reportRetiredAgentsFiles() {
|
|
51249
51269
|
const leftovers = retired.filter((file) => fs61.existsSync(file));
|
|
@@ -51257,12 +51277,62 @@ function reportRetiredAgentsFiles() {
|
|
|
51257
51277
|
);
|
|
51258
51278
|
}
|
|
51259
51279
|
|
|
51280
|
+
// src/commands/sync/retiredOwnedPaths.ts
|
|
51281
|
+
import * as fs62 from "fs";
|
|
51282
|
+
import * as path115 from "path";
|
|
51283
|
+
|
|
51284
|
+
// src/commands/sync/retiredSyncNames.ts
|
|
51285
|
+
var retiredSyncNames = {
|
|
51286
|
+
commands: [
|
|
51287
|
+
"adopt-rules",
|
|
51288
|
+
"associate-jira",
|
|
51289
|
+
"generate-cli-read-verbs",
|
|
51290
|
+
"handover",
|
|
51291
|
+
"high-level-config",
|
|
51292
|
+
"journal",
|
|
51293
|
+
"next-backlog-item",
|
|
51294
|
+
"recall",
|
|
51295
|
+
"review",
|
|
51296
|
+
"review-comments",
|
|
51297
|
+
"standup",
|
|
51298
|
+
"strip-code-comments",
|
|
51299
|
+
"strip-comments",
|
|
51300
|
+
"subtask",
|
|
51301
|
+
"transcript-format",
|
|
51302
|
+
"transcript-summarise",
|
|
51303
|
+
"update-jira",
|
|
51304
|
+
"voice-logs",
|
|
51305
|
+
"voice-setup",
|
|
51306
|
+
"voice-start",
|
|
51307
|
+
"voice-status",
|
|
51308
|
+
"voice-stop"
|
|
51309
|
+
],
|
|
51310
|
+
skillDirs: ["review-ci"]
|
|
51311
|
+
};
|
|
51312
|
+
|
|
51313
|
+
// src/commands/sync/retiredOwnedPaths.ts
|
|
51314
|
+
function retiredOwnedPaths() {
|
|
51315
|
+
const { claude, codex, pi } = harnesses;
|
|
51316
|
+
const paths = retiredSyncNames.commands.flatMap((name2) => [
|
|
51317
|
+
path115.join(claude.homeDir, "commands", `${name2}.md`),
|
|
51318
|
+
path115.join(claude.homeDir, claude.sync.commandDest(name2)),
|
|
51319
|
+
path115.join(codex.homeDir, codex.sync.commandDest(name2)),
|
|
51320
|
+
path115.join(pi.homeDir, pi.sync.commandDest(name2))
|
|
51321
|
+
]);
|
|
51322
|
+
for (const name2 of retiredSyncNames.skillDirs)
|
|
51323
|
+
paths.push(
|
|
51324
|
+
path115.join(claude.homeDir, "skills", name2),
|
|
51325
|
+
path115.join(codex.homeDir, "skills", name2)
|
|
51326
|
+
);
|
|
51327
|
+
return paths.filter((file) => fs62.existsSync(file));
|
|
51328
|
+
}
|
|
51329
|
+
|
|
51260
51330
|
// src/commands/sync/syncCodex.ts
|
|
51261
|
-
import * as
|
|
51331
|
+
import * as path119 from "path";
|
|
51262
51332
|
|
|
51263
51333
|
// src/commands/sync/installDesignResources.ts
|
|
51264
|
-
import * as
|
|
51265
|
-
import * as
|
|
51334
|
+
import * as fs63 from "fs";
|
|
51335
|
+
import * as path116 from "path";
|
|
51266
51336
|
|
|
51267
51337
|
// src/commands/sync/designSkillToNative.ts
|
|
51268
51338
|
function designSkillToNative(name2, content) {
|
|
@@ -51282,18 +51352,18 @@ ${content}`
|
|
|
51282
51352
|
function installDesignResources(claudeDir, harness, files) {
|
|
51283
51353
|
const { homeDir, sync: sync2 } = harness;
|
|
51284
51354
|
files.write(
|
|
51285
|
-
|
|
51286
|
-
|
|
51355
|
+
path116.join(homeDir, sync2.designPromptDest),
|
|
51356
|
+
fs63.readFileSync(path116.join(claudeDir, "design-system-prompt.md"), "utf8")
|
|
51287
51357
|
);
|
|
51288
|
-
const skillsSource =
|
|
51358
|
+
const skillsSource = path116.join(claudeDir, "skills");
|
|
51289
51359
|
const names = markdownNames(skillsSource);
|
|
51290
51360
|
for (const name2 of names) {
|
|
51291
|
-
const content =
|
|
51292
|
-
|
|
51361
|
+
const content = fs63.readFileSync(
|
|
51362
|
+
path116.join(skillsSource, `${name2}.md`),
|
|
51293
51363
|
"utf8"
|
|
51294
51364
|
);
|
|
51295
51365
|
files.write(
|
|
51296
|
-
|
|
51366
|
+
path116.join(homeDir, sync2.designSkillDest(name2)),
|
|
51297
51367
|
sync2.nativeDesignSkills ? designSkillToNative(name2, content) : content
|
|
51298
51368
|
);
|
|
51299
51369
|
}
|
|
@@ -51301,19 +51371,19 @@ function installDesignResources(claudeDir, harness, files) {
|
|
|
51301
51371
|
}
|
|
51302
51372
|
|
|
51303
51373
|
// src/commands/sync/installHarnessCommands.ts
|
|
51304
|
-
import * as
|
|
51305
|
-
import * as
|
|
51374
|
+
import * as fs64 from "fs";
|
|
51375
|
+
import * as path117 from "path";
|
|
51306
51376
|
function installHarnessCommands(claudeDir, harness, transform, files) {
|
|
51307
|
-
const commandsSource =
|
|
51308
|
-
const sourceFiles =
|
|
51377
|
+
const commandsSource = path117.join(claudeDir, "commands");
|
|
51378
|
+
const sourceFiles = fs64.readdirSync(commandsSource);
|
|
51309
51379
|
const names = [];
|
|
51310
51380
|
for (const file of sourceFiles) {
|
|
51311
51381
|
if (!file.endsWith(".md")) continue;
|
|
51312
51382
|
const name2 = file.replace(/\.md$/, "");
|
|
51313
51383
|
names.push(name2);
|
|
51314
|
-
const content =
|
|
51384
|
+
const content = fs64.readFileSync(path117.join(commandsSource, file), "utf8");
|
|
51315
51385
|
files.write(
|
|
51316
|
-
|
|
51386
|
+
path117.join(harness.homeDir, harness.sync.commandDest(name2)),
|
|
51317
51387
|
transform(name2, renderHarnessPaths(content, harness))
|
|
51318
51388
|
);
|
|
51319
51389
|
}
|
|
@@ -51321,15 +51391,15 @@ function installHarnessCommands(claudeDir, harness, transform, files) {
|
|
|
51321
51391
|
}
|
|
51322
51392
|
|
|
51323
51393
|
// src/commands/sync/syncCodexHooks.ts
|
|
51324
|
-
import * as
|
|
51325
|
-
import * as
|
|
51394
|
+
import * as fs65 from "fs";
|
|
51395
|
+
import * as path118 from "path";
|
|
51326
51396
|
async function syncCodexHooks(sourcePath) {
|
|
51327
|
-
const body =
|
|
51328
|
-
const configPath =
|
|
51329
|
-
const existing =
|
|
51397
|
+
const body = fs65.readFileSync(sourcePath, "utf8");
|
|
51398
|
+
const configPath = path118.join(harnesses.codex.homeDir, "config.toml");
|
|
51399
|
+
const existing = fs65.existsSync(configPath) ? fs65.readFileSync(configPath, "utf8") : "";
|
|
51330
51400
|
const next3 = upsertManagedBlock(existing, body);
|
|
51331
|
-
|
|
51332
|
-
|
|
51401
|
+
fs65.mkdirSync(path118.dirname(configPath), { recursive: true });
|
|
51402
|
+
fs65.writeFileSync(configPath, next3);
|
|
51333
51403
|
console.log(
|
|
51334
51404
|
"Registered assist codex-hook in ~/.codex/config.toml (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PermissionRequest, Stop)"
|
|
51335
51405
|
);
|
|
@@ -51363,7 +51433,7 @@ async function syncCodex(claudeDir, files, options2) {
|
|
|
51363
51433
|
harnesses.codex,
|
|
51364
51434
|
files
|
|
51365
51435
|
);
|
|
51366
|
-
await syncCodexHooks(
|
|
51436
|
+
await syncCodexHooks(path119.join(claudeDir, "..", "codex", "config.toml"));
|
|
51367
51437
|
console.log(`Synced ${total2} skill(s) to ~/.codex/skills`);
|
|
51368
51438
|
console.log(
|
|
51369
51439
|
`Synced the design system prompt and ${designSkills.length} design skill(s) for Codex`
|
|
@@ -51373,7 +51443,7 @@ async function syncCodex(claudeDir, files, options2) {
|
|
|
51373
51443
|
reportPrune(
|
|
51374
51444
|
"~/.codex/skills",
|
|
51375
51445
|
pruneSkills(
|
|
51376
|
-
|
|
51446
|
+
path119.join(harnesses.codex.homeDir, "skills"),
|
|
51377
51447
|
[...names, ...designSkills],
|
|
51378
51448
|
{ force, owner: files }
|
|
51379
51449
|
),
|
|
@@ -51382,34 +51452,36 @@ async function syncCodex(claudeDir, files, options2) {
|
|
|
51382
51452
|
}
|
|
51383
51453
|
|
|
51384
51454
|
// src/commands/sync/syncDesign.ts
|
|
51385
|
-
import * as
|
|
51386
|
-
import * as
|
|
51455
|
+
import * as fs66 from "fs";
|
|
51456
|
+
import * as path120 from "path";
|
|
51387
51457
|
function syncDesign(claudeDir, targetBase, files) {
|
|
51388
51458
|
files.write(
|
|
51389
|
-
|
|
51390
|
-
|
|
51459
|
+
path120.join(targetBase, "design-system-prompt.md"),
|
|
51460
|
+
fs66.readFileSync(path120.join(claudeDir, "design-system-prompt.md"), "utf8")
|
|
51391
51461
|
);
|
|
51392
51462
|
console.log(
|
|
51393
51463
|
"Copied design-system-prompt.md to ~/.claude/design-system-prompt.md"
|
|
51394
51464
|
);
|
|
51395
|
-
const skillsSource =
|
|
51396
|
-
const skillsTarget =
|
|
51397
|
-
const entries =
|
|
51465
|
+
const skillsSource = path120.join(claudeDir, "skills");
|
|
51466
|
+
const skillsTarget = path120.join(targetBase, "skills");
|
|
51467
|
+
const entries = fs66.readdirSync(skillsSource, { withFileTypes: true }).filter(
|
|
51468
|
+
(entry) => !entry.isDirectory() || fs66.existsSync(path120.join(skillsSource, entry.name, "SKILL.md"))
|
|
51469
|
+
);
|
|
51398
51470
|
for (const entry of entries) {
|
|
51399
|
-
const source =
|
|
51400
|
-
const target =
|
|
51471
|
+
const source = path120.join(skillsSource, entry.name);
|
|
51472
|
+
const target = path120.join(skillsTarget, entry.name);
|
|
51401
51473
|
if (entry.isDirectory()) {
|
|
51402
51474
|
files.copyDir(source, target);
|
|
51403
51475
|
} else {
|
|
51404
|
-
files.write(target,
|
|
51476
|
+
files.write(target, fs66.readFileSync(source, "utf8"));
|
|
51405
51477
|
}
|
|
51406
51478
|
}
|
|
51407
51479
|
console.log(`Synced ${entries.length} skill(s) to ~/.claude/skills`);
|
|
51408
|
-
return entries.
|
|
51480
|
+
return entries.map((entry) => entry.name);
|
|
51409
51481
|
}
|
|
51410
51482
|
|
|
51411
51483
|
// src/commands/sync/syncPi.ts
|
|
51412
|
-
import * as
|
|
51484
|
+
import * as path121 from "path";
|
|
51413
51485
|
import { stringify as stringify4 } from "yaml";
|
|
51414
51486
|
function unquote(value) {
|
|
51415
51487
|
return value.trim().replace(/^["']|["']$/g, "");
|
|
@@ -51438,7 +51510,7 @@ function syncPi(claudeDir, files, options2) {
|
|
|
51438
51510
|
files
|
|
51439
51511
|
);
|
|
51440
51512
|
const designSkills = installDesignResources(claudeDir, harnesses.pi, files);
|
|
51441
|
-
syncPiHooks(
|
|
51513
|
+
syncPiHooks(path121.join(claudeDir, "..", "pi"));
|
|
51442
51514
|
console.log(`Synced ${synced} prompt(s) to ~/.pi/agent/prompts`);
|
|
51443
51515
|
console.log(
|
|
51444
51516
|
`Synced the design system prompt and ${designSkills.length} design skill(s) to ~/.pi/agent/assist`
|
|
@@ -51447,7 +51519,7 @@ function syncPi(claudeDir, files, options2) {
|
|
|
51447
51519
|
const force = options2.force ?? false;
|
|
51448
51520
|
reportPrune(
|
|
51449
51521
|
"~/.pi/agent/prompts",
|
|
51450
|
-
pruneCommands(
|
|
51522
|
+
pruneCommands(path121.join(harnesses.pi.homeDir, "prompts"), names, {
|
|
51451
51523
|
force,
|
|
51452
51524
|
owner: files
|
|
51453
51525
|
}),
|
|
@@ -51456,8 +51528,8 @@ function syncPi(claudeDir, files, options2) {
|
|
|
51456
51528
|
}
|
|
51457
51529
|
|
|
51458
51530
|
// src/commands/sync/syncSettings.ts
|
|
51459
|
-
import * as
|
|
51460
|
-
import * as
|
|
51531
|
+
import * as fs68 from "fs";
|
|
51532
|
+
import * as path123 from "path";
|
|
51461
51533
|
import chalk292 from "chalk";
|
|
51462
51534
|
|
|
51463
51535
|
// src/commands/sync/mergeSettings.ts
|
|
@@ -51496,26 +51568,26 @@ function mergeSettings(user, assist) {
|
|
|
51496
51568
|
}
|
|
51497
51569
|
|
|
51498
51570
|
// src/commands/sync/readSourceSettings.ts
|
|
51499
|
-
import * as
|
|
51500
|
-
import * as
|
|
51571
|
+
import * as fs67 from "fs";
|
|
51572
|
+
import * as path122 from "path";
|
|
51501
51573
|
function readJson(file) {
|
|
51502
|
-
return JSON.parse(
|
|
51574
|
+
return JSON.parse(fs67.readFileSync(file, "utf8"));
|
|
51503
51575
|
}
|
|
51504
51576
|
function readSourceSettings(claudeDir, preferences) {
|
|
51505
|
-
const required = readJson(
|
|
51577
|
+
const required = readJson(path122.join(claudeDir, "settings.json"));
|
|
51506
51578
|
if (!preferences) return required;
|
|
51507
51579
|
return mergeSettings(
|
|
51508
51580
|
required,
|
|
51509
|
-
readJson(
|
|
51581
|
+
readJson(path122.join(claudeDir, "preferences.json"))
|
|
51510
51582
|
);
|
|
51511
51583
|
}
|
|
51512
51584
|
|
|
51513
51585
|
// src/commands/sync/syncSettings.ts
|
|
51514
51586
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
51515
|
-
const target =
|
|
51587
|
+
const target = path123.join(targetBase, "settings.json");
|
|
51516
51588
|
const sourceSettings = readSourceSettings(claudeDir, options2?.preferences);
|
|
51517
|
-
const targetExists =
|
|
51518
|
-
const targetContent = targetExists ?
|
|
51589
|
+
const targetExists = fs68.existsSync(target);
|
|
51590
|
+
const targetContent = targetExists ? fs68.readFileSync(target, "utf8") : "";
|
|
51519
51591
|
const preservedUserSettings = targetExists ? JSON.parse(targetContent) : {};
|
|
51520
51592
|
const mergedContent = JSON.stringify(
|
|
51521
51593
|
mergeSettings(preservedUserSettings, sourceSettings),
|
|
@@ -51545,22 +51617,25 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
51545
51617
|
}
|
|
51546
51618
|
}
|
|
51547
51619
|
}
|
|
51548
|
-
|
|
51620
|
+
fs68.writeFileSync(target, mergedContent);
|
|
51549
51621
|
console.log("Merged settings.json into ~/.claude/settings.json");
|
|
51550
51622
|
}
|
|
51551
51623
|
|
|
51552
51624
|
// src/commands/sync.ts
|
|
51553
51625
|
var __filename5 = fileURLToPath9(import.meta.url);
|
|
51554
|
-
var __dirname6 =
|
|
51626
|
+
var __dirname6 = path124.dirname(__filename5);
|
|
51555
51627
|
async function sync(options2) {
|
|
51556
51628
|
const config = loadConfig();
|
|
51557
51629
|
const yes = options2?.yes ?? config.sync.autoConfirm;
|
|
51558
51630
|
const prune = { prune: options2?.prune, force: options2?.force };
|
|
51559
|
-
const claudeDir =
|
|
51560
|
-
const targetBase =
|
|
51561
|
-
const files = createSyncFiles(
|
|
51631
|
+
const claudeDir = path124.join(__dirname6, "..", "claude");
|
|
51632
|
+
const targetBase = path124.join(os6.homedir(), ".claude");
|
|
51633
|
+
const files = createSyncFiles([
|
|
51634
|
+
...syncManifest.load(),
|
|
51635
|
+
...retiredOwnedPaths()
|
|
51636
|
+
]);
|
|
51562
51637
|
const commandNames = syncClaudeCommands(claudeDir, targetBase, files);
|
|
51563
|
-
const
|
|
51638
|
+
const designSkillNames = syncDesign(claudeDir, targetBase, files);
|
|
51564
51639
|
await syncSettings(claudeDir, targetBase, {
|
|
51565
51640
|
yes,
|
|
51566
51641
|
preferences: config.sync.preferences
|
|
@@ -51568,26 +51643,7 @@ async function sync(options2) {
|
|
|
51568
51643
|
await syncCodex(claudeDir, files, prune);
|
|
51569
51644
|
syncPi(claudeDir, files, prune);
|
|
51570
51645
|
reportRetiredAgentsFiles();
|
|
51571
|
-
|
|
51572
|
-
const force = options2.force ?? false;
|
|
51573
|
-
reportPrune(
|
|
51574
|
-
"~/.claude/skills",
|
|
51575
|
-
pruneSkills(
|
|
51576
|
-
path122.join(targetBase, "skills"),
|
|
51577
|
-
[...commandNames, ...skillDirNames],
|
|
51578
|
-
{ force, owner: files }
|
|
51579
|
-
),
|
|
51580
|
-
force
|
|
51581
|
-
);
|
|
51582
|
-
reportPrune(
|
|
51583
|
-
"~/.claude/commands",
|
|
51584
|
-
pruneCommands(path122.join(targetBase, "commands"), [], {
|
|
51585
|
-
force,
|
|
51586
|
-
owner: files
|
|
51587
|
-
}),
|
|
51588
|
-
force
|
|
51589
|
-
);
|
|
51590
|
-
}
|
|
51646
|
+
pruneClaude(targetBase, [...commandNames, ...designSkillNames], prune, files);
|
|
51591
51647
|
await files.finish(yes);
|
|
51592
51648
|
}
|
|
51593
51649
|
|
|
@@ -51642,7 +51698,7 @@ function registerTestflight(program) {
|
|
|
51642
51698
|
}
|
|
51643
51699
|
|
|
51644
51700
|
// src/commands/transcript/clean.ts
|
|
51645
|
-
import { existsSync as
|
|
51701
|
+
import { existsSync as existsSync92 } from "fs";
|
|
51646
51702
|
|
|
51647
51703
|
// src/commands/transcript/convert/formatTimestamp.ts
|
|
51648
51704
|
function pad2(value, width2) {
|
|
@@ -51920,7 +51976,7 @@ function clean(file, options2 = {}) {
|
|
|
51920
51976
|
);
|
|
51921
51977
|
process.exit(1);
|
|
51922
51978
|
}
|
|
51923
|
-
if (!
|
|
51979
|
+
if (!existsSync92(file)) {
|
|
51924
51980
|
console.error(`Error: VTT file not found: ${file}`);
|
|
51925
51981
|
process.exit(1);
|
|
51926
51982
|
}
|
|
@@ -52003,21 +52059,21 @@ async function configure() {
|
|
|
52003
52059
|
}
|
|
52004
52060
|
|
|
52005
52061
|
// src/commands/transcript/list.ts
|
|
52006
|
-
import { existsSync as
|
|
52007
|
-
import { join as
|
|
52062
|
+
import { existsSync as existsSync93, readdirSync as readdirSync25, statSync as statSync17 } from "fs";
|
|
52063
|
+
import { join as join121 } from "path";
|
|
52008
52064
|
function list5() {
|
|
52009
52065
|
const { vttDir } = getTranscriptConfig();
|
|
52010
|
-
if (!
|
|
52066
|
+
if (!existsSync93(vttDir)) return;
|
|
52011
52067
|
for (const entry of readdirSync25(vttDir)) {
|
|
52012
52068
|
if (!entry.endsWith(".vtt")) continue;
|
|
52013
|
-
if (
|
|
52069
|
+
if (statSync17(join121(vttDir, entry)).isDirectory()) continue;
|
|
52014
52070
|
console.log(entry);
|
|
52015
52071
|
}
|
|
52016
52072
|
}
|
|
52017
52073
|
|
|
52018
52074
|
// src/commands/transcript/move.ts
|
|
52019
|
-
import { existsSync as
|
|
52020
|
-
import { basename as basename31, join as
|
|
52075
|
+
import { existsSync as existsSync94, mkdirSync as mkdirSync40, renameSync as renameSync5, writeFileSync as writeFileSync56 } from "fs";
|
|
52076
|
+
import { basename as basename31, join as join122 } from "path";
|
|
52021
52077
|
|
|
52022
52078
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
52023
52079
|
function convertVttToMarkdown(inputPath) {
|
|
@@ -52027,9 +52083,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
52027
52083
|
// src/commands/transcript/move.ts
|
|
52028
52084
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
52029
52085
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
52030
|
-
const processedDir =
|
|
52086
|
+
const processedDir = join122(vttDir, "processed");
|
|
52031
52087
|
mkdirSync40(processedDir, { recursive: true });
|
|
52032
|
-
renameSync5(sourcePath,
|
|
52088
|
+
renameSync5(sourcePath, join122(processedDir, filename));
|
|
52033
52089
|
}
|
|
52034
52090
|
function move(file, options2) {
|
|
52035
52091
|
const { date, client } = options2;
|
|
@@ -52039,25 +52095,25 @@ function move(file, options2) {
|
|
|
52039
52095
|
}
|
|
52040
52096
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
52041
52097
|
const filename = basename31(file);
|
|
52042
|
-
const sourcePath =
|
|
52043
|
-
if (!
|
|
52098
|
+
const sourcePath = join122(vttDir, filename);
|
|
52099
|
+
if (!existsSync94(sourcePath)) {
|
|
52044
52100
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
52045
52101
|
process.exit(1);
|
|
52046
52102
|
}
|
|
52047
52103
|
const base = basename31(filename, ".vtt").replace(/ Transcription$/, "");
|
|
52048
52104
|
const outputName = `${date} ${base}.md`;
|
|
52049
|
-
const formattedDir =
|
|
52105
|
+
const formattedDir = join122(transcriptsDir, client);
|
|
52050
52106
|
mkdirSync40(formattedDir, { recursive: true });
|
|
52051
|
-
const formattedPath =
|
|
52107
|
+
const formattedPath = join122(formattedDir, outputName);
|
|
52052
52108
|
writeFileSync56(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
52053
52109
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
52054
|
-
const summaryPath =
|
|
52110
|
+
const summaryPath = join122(summaryDir, client, outputName);
|
|
52055
52111
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
52056
52112
|
console.log(`Summary target: ${summaryPath}`);
|
|
52057
52113
|
}
|
|
52058
52114
|
|
|
52059
52115
|
// src/commands/transcript/merge.ts
|
|
52060
|
-
import { existsSync as
|
|
52116
|
+
import { existsSync as existsSync95, writeFileSync as writeFileSync57 } from "fs";
|
|
52061
52117
|
import { basename as basename32 } from "path";
|
|
52062
52118
|
|
|
52063
52119
|
// src/commands/transcript/failTranscript.ts
|
|
@@ -52201,7 +52257,7 @@ function widenAudience(passages) {
|
|
|
52201
52257
|
|
|
52202
52258
|
// src/commands/transcript/merge.ts
|
|
52203
52259
|
function readSource3(file) {
|
|
52204
|
-
if (!
|
|
52260
|
+
if (!existsSync95(file)) failTranscript(`VTT file not found: ${file}`);
|
|
52205
52261
|
const cues = readCleanedCues(file);
|
|
52206
52262
|
if (cues.length === 0) failTranscript(`no cues found in: ${file}`);
|
|
52207
52263
|
return { path: file, name: basename32(file), cues };
|
|
@@ -52353,11 +52409,11 @@ function adviceFragments() {
|
|
|
52353
52409
|
|
|
52354
52410
|
// src/commands/verify/blockCodeComments/findComments.ts
|
|
52355
52411
|
import { execSync as execSync62 } from "child_process";
|
|
52356
|
-
import
|
|
52412
|
+
import fs70 from "fs";
|
|
52357
52413
|
import { Project as Project6 } from "ts-morph";
|
|
52358
52414
|
|
|
52359
52415
|
// src/commands/verify/blockCodeComments/collectFileComments.ts
|
|
52360
|
-
import
|
|
52416
|
+
import fs69 from "fs";
|
|
52361
52417
|
|
|
52362
52418
|
// src/shared/isBicepFile.ts
|
|
52363
52419
|
var BICEP_EXTENSIONS = [".bicep", ".bicepparam"];
|
|
@@ -52506,7 +52562,7 @@ function toFindings(file, lines, raw, exempt) {
|
|
|
52506
52562
|
|
|
52507
52563
|
// src/commands/verify/blockCodeComments/collectFileComments.ts
|
|
52508
52564
|
function collectFileComments(file, lines, project) {
|
|
52509
|
-
const read4 = () =>
|
|
52565
|
+
const read4 = () => fs69.readFileSync(file, "utf8");
|
|
52510
52566
|
if (isYamlFile(file))
|
|
52511
52567
|
return toFindings(file, lines, collectYamlComments(read4()), false);
|
|
52512
52568
|
if (isDockerfile(file) || isEnvFile(file) || isShellFile(file))
|
|
@@ -52587,7 +52643,7 @@ function shouldScan(file, ignoreGlobs) {
|
|
|
52587
52643
|
if (!SCANNED_EXTENSIONS.some((ext) => file.endsWith(ext)) && !isHashCommentFile(file))
|
|
52588
52644
|
return false;
|
|
52589
52645
|
if (isCommentGateIgnored(file, ignoreGlobs)) return false;
|
|
52590
|
-
return
|
|
52646
|
+
return fs70.existsSync(file);
|
|
52591
52647
|
}
|
|
52592
52648
|
function findComments(options2) {
|
|
52593
52649
|
const diff3 = execSync62("git diff HEAD", {
|
|
@@ -52673,13 +52729,13 @@ function configKeys2() {
|
|
|
52673
52729
|
}
|
|
52674
52730
|
|
|
52675
52731
|
// src/commands/verify/forbiddenStrings.ts
|
|
52676
|
-
import { existsSync as
|
|
52732
|
+
import { existsSync as existsSync96, readFileSync as readFileSync84 } from "fs";
|
|
52677
52733
|
|
|
52678
52734
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
52679
52735
|
import { minimatch as minimatch10 } from "minimatch";
|
|
52680
|
-
function resolveStringsAtPath(data,
|
|
52736
|
+
function resolveStringsAtPath(data, path128) {
|
|
52681
52737
|
let current2 = data;
|
|
52682
|
-
for (const segment of
|
|
52738
|
+
for (const segment of path128.split(".")) {
|
|
52683
52739
|
if (current2 === null || typeof current2 !== "object") return [];
|
|
52684
52740
|
current2 = current2[segment];
|
|
52685
52741
|
}
|
|
@@ -52692,10 +52748,10 @@ function resolveStringsAtPath(data, path126) {
|
|
|
52692
52748
|
}
|
|
52693
52749
|
function findRuleViolations(data, rule) {
|
|
52694
52750
|
const violations = [];
|
|
52695
|
-
for (const
|
|
52696
|
-
for (const value of resolveStringsAtPath(data,
|
|
52751
|
+
for (const path128 of rule.paths) {
|
|
52752
|
+
for (const value of resolveStringsAtPath(data, path128)) {
|
|
52697
52753
|
if (minimatch10(value, rule.disallowed))
|
|
52698
|
-
violations.push({ file: rule.file, path:
|
|
52754
|
+
violations.push({ file: rule.file, path: path128, value });
|
|
52699
52755
|
}
|
|
52700
52756
|
}
|
|
52701
52757
|
return violations;
|
|
@@ -52714,7 +52770,7 @@ function forbiddenStrings() {
|
|
|
52714
52770
|
const cache7 = /* @__PURE__ */ new Map();
|
|
52715
52771
|
const readJson2 = (file) => {
|
|
52716
52772
|
if (cache7.has(file)) return cache7.get(file);
|
|
52717
|
-
if (!
|
|
52773
|
+
if (!existsSync96(file)) {
|
|
52718
52774
|
console.log(`Forbidden-strings file not found: ${file}`);
|
|
52719
52775
|
process.exit(1);
|
|
52720
52776
|
}
|
|
@@ -52734,8 +52790,8 @@ function forbiddenStrings() {
|
|
|
52734
52790
|
process.exit(0);
|
|
52735
52791
|
}
|
|
52736
52792
|
console.log("Forbidden strings found:\n");
|
|
52737
|
-
for (const { file, path:
|
|
52738
|
-
console.log(` ${file} ${
|
|
52793
|
+
for (const { file, path: path128, value } of violations) {
|
|
52794
|
+
console.log(` ${file} ${path128}: ${value}`);
|
|
52739
52795
|
}
|
|
52740
52796
|
console.log(`
|
|
52741
52797
|
Total: ${violations.length} forbidden string(s).`);
|
|
@@ -52838,7 +52894,7 @@ async function harnessFollowUps() {
|
|
|
52838
52894
|
|
|
52839
52895
|
// src/commands/verify/migrations.ts
|
|
52840
52896
|
import { readFileSync as readFileSync85 } from "fs";
|
|
52841
|
-
import
|
|
52897
|
+
import path126 from "path";
|
|
52842
52898
|
|
|
52843
52899
|
// src/commands/verify/migrations/checkAppendOnly.ts
|
|
52844
52900
|
function checkAppendOnly(baseline, current2) {
|
|
@@ -52930,15 +52986,15 @@ function readBaselineMigrations(repoRelativeDir, ref) {
|
|
|
52930
52986
|
} catch {
|
|
52931
52987
|
return baseline;
|
|
52932
52988
|
}
|
|
52933
|
-
const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((
|
|
52934
|
-
for (const
|
|
52989
|
+
const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path128) => MIGRATION_FILE3.test(basename33(path128)));
|
|
52990
|
+
for (const path128 of paths) {
|
|
52935
52991
|
try {
|
|
52936
|
-
const content = execSync63(`git show "${ref}:${
|
|
52992
|
+
const content = execSync63(`git show "${ref}:${path128}"`, {
|
|
52937
52993
|
encoding: "utf8",
|
|
52938
52994
|
maxBuffer: 16 * 1024 * 1024,
|
|
52939
52995
|
stdio: ["pipe", "pipe", "pipe"]
|
|
52940
52996
|
});
|
|
52941
|
-
baseline.set(basename33(
|
|
52997
|
+
baseline.set(basename33(path128), content);
|
|
52942
52998
|
} catch {
|
|
52943
52999
|
}
|
|
52944
53000
|
}
|
|
@@ -52977,11 +53033,11 @@ function resolveBaselineRef() {
|
|
|
52977
53033
|
}
|
|
52978
53034
|
|
|
52979
53035
|
// src/commands/verify/migrations/migrationsDir.ts
|
|
52980
|
-
import
|
|
53036
|
+
import path125 from "path";
|
|
52981
53037
|
import { fileURLToPath as fileURLToPath10 } from "url";
|
|
52982
53038
|
function migrationsDir() {
|
|
52983
|
-
return
|
|
52984
|
-
|
|
53039
|
+
return path125.resolve(
|
|
53040
|
+
path125.dirname(fileURLToPath10(import.meta.url)),
|
|
52985
53041
|
"../../../shared/db/migrations"
|
|
52986
53042
|
);
|
|
52987
53043
|
}
|
|
@@ -53002,7 +53058,7 @@ function migrations2() {
|
|
|
53002
53058
|
if (ref) {
|
|
53003
53059
|
const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
|
|
53004
53060
|
const current2 = new Map(
|
|
53005
|
-
files.map((file) => [file, readFileSync85(
|
|
53061
|
+
files.map((file) => [file, readFileSync85(path126.join(dir, file), "utf8")])
|
|
53006
53062
|
);
|
|
53007
53063
|
for (const finding of checkAppendOnly(baseline, current2)) {
|
|
53008
53064
|
problems.push(
|
|
@@ -53195,7 +53251,7 @@ function clearBuildPending() {
|
|
|
53195
53251
|
}
|
|
53196
53252
|
|
|
53197
53253
|
// src/commands/watch/isSyncPending.ts
|
|
53198
|
-
import { existsSync as
|
|
53254
|
+
import { existsSync as existsSync97 } from "fs";
|
|
53199
53255
|
|
|
53200
53256
|
// src/commands/watch/syncPendingPath.ts
|
|
53201
53257
|
function syncPendingPath(cwd) {
|
|
@@ -53205,7 +53261,7 @@ function syncPendingPath(cwd) {
|
|
|
53205
53261
|
// src/commands/watch/isSyncPending.ts
|
|
53206
53262
|
function isSyncPending() {
|
|
53207
53263
|
try {
|
|
53208
|
-
return
|
|
53264
|
+
return existsSync97(syncPendingPath());
|
|
53209
53265
|
} catch {
|
|
53210
53266
|
return false;
|
|
53211
53267
|
}
|
|
@@ -53332,7 +53388,7 @@ function resolveParams(params, cliArgs) {
|
|
|
53332
53388
|
}
|
|
53333
53389
|
|
|
53334
53390
|
// src/commands/run/resolveRunCwd.ts
|
|
53335
|
-
import { existsSync as
|
|
53391
|
+
import { existsSync as existsSync98 } from "fs";
|
|
53336
53392
|
import { resolve as resolve32 } from "path";
|
|
53337
53393
|
var MissingRunCwdError = class extends Error {
|
|
53338
53394
|
constructor(runName, cwd) {
|
|
@@ -53347,7 +53403,7 @@ var MissingRunCwdError = class extends Error {
|
|
|
53347
53403
|
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
53348
53404
|
if (!config.cwd) return void 0;
|
|
53349
53405
|
const cwd = resolve32(baseDir, config.cwd);
|
|
53350
|
-
if (!
|
|
53406
|
+
if (!existsSync98(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
53351
53407
|
return cwd;
|
|
53352
53408
|
}
|
|
53353
53409
|
|
|
@@ -53484,27 +53540,27 @@ function restartAdvice(paths) {
|
|
|
53484
53540
|
// src/commands/watch/syncAdvice.ts
|
|
53485
53541
|
var rules = [
|
|
53486
53542
|
{
|
|
53487
|
-
matches: (
|
|
53543
|
+
matches: (path128) => path128.startsWith("claude/commands/"),
|
|
53488
53544
|
reason: "claude/commands changed"
|
|
53489
53545
|
},
|
|
53490
53546
|
{
|
|
53491
|
-
matches: (
|
|
53547
|
+
matches: (path128) => path128.startsWith("claude/skills/"),
|
|
53492
53548
|
reason: "claude/skills changed"
|
|
53493
53549
|
},
|
|
53494
53550
|
{
|
|
53495
|
-
matches: (
|
|
53551
|
+
matches: (path128) => path128 === "claude/settings.json",
|
|
53496
53552
|
reason: "claude/settings.json changed"
|
|
53497
53553
|
},
|
|
53498
53554
|
{
|
|
53499
|
-
matches: (
|
|
53555
|
+
matches: (path128) => path128 === "claude/design-system-prompt.md",
|
|
53500
53556
|
reason: "claude/design-system-prompt.md changed"
|
|
53501
53557
|
},
|
|
53502
53558
|
{
|
|
53503
|
-
matches: (
|
|
53559
|
+
matches: (path128) => path128.startsWith("codex/"),
|
|
53504
53560
|
reason: "codex sources changed"
|
|
53505
53561
|
},
|
|
53506
53562
|
{
|
|
53507
|
-
matches: (
|
|
53563
|
+
matches: (path128) => path128.startsWith("pi/"),
|
|
53508
53564
|
reason: "pi sources changed"
|
|
53509
53565
|
}
|
|
53510
53566
|
];
|
|
@@ -53682,11 +53738,11 @@ ${buildWatchReport(from)}`);
|
|
|
53682
53738
|
}
|
|
53683
53739
|
|
|
53684
53740
|
// src/commands/watch/consumeMarker.ts
|
|
53685
|
-
import { existsSync as
|
|
53686
|
-
function consumeMarker(
|
|
53741
|
+
import { existsSync as existsSync99, rmSync as rmSync15 } from "fs";
|
|
53742
|
+
function consumeMarker(path128) {
|
|
53687
53743
|
try {
|
|
53688
|
-
if (!
|
|
53689
|
-
rmSync15(
|
|
53744
|
+
if (!existsSync99(path128)) return false;
|
|
53745
|
+
rmSync15(path128);
|
|
53690
53746
|
return true;
|
|
53691
53747
|
} catch {
|
|
53692
53748
|
return false;
|
|
@@ -53982,8 +54038,8 @@ function registerWatch(program) {
|
|
|
53982
54038
|
|
|
53983
54039
|
// src/commands/roam/postRoamActivity.ts
|
|
53984
54040
|
import { execFileSync as execFileSync32 } from "child_process";
|
|
53985
|
-
import { readdirSync as readdirSync27, readFileSync as readFileSync86, statSync as
|
|
53986
|
-
import { join as
|
|
54041
|
+
import { readdirSync as readdirSync27, readFileSync as readFileSync86, statSync as statSync18 } from "fs";
|
|
54042
|
+
import { join as join123 } from "path";
|
|
53987
54043
|
function findPortFile(roamDir) {
|
|
53988
54044
|
let entries;
|
|
53989
54045
|
try {
|
|
@@ -53992,9 +54048,9 @@ function findPortFile(roamDir) {
|
|
|
53992
54048
|
return void 0;
|
|
53993
54049
|
}
|
|
53994
54050
|
const candidates = entries.filter((name2) => /^roam-local-api(-[^.]+)?\.port$/.test(name2)).map((name2) => {
|
|
53995
|
-
const
|
|
54051
|
+
const path128 = join123(roamDir, name2);
|
|
53996
54052
|
try {
|
|
53997
|
-
return { path:
|
|
54053
|
+
return { path: path128, mtimeMs: statSync18(path128).mtimeMs };
|
|
53998
54054
|
} catch {
|
|
53999
54055
|
return void 0;
|
|
54000
54056
|
}
|
|
@@ -54009,7 +54065,7 @@ var PID_BY_APP = {
|
|
|
54009
54065
|
function postRoamActivity(app, event) {
|
|
54010
54066
|
const appData = process.env.APPDATA;
|
|
54011
54067
|
if (!appData) return;
|
|
54012
|
-
const portFile = findPortFile(
|
|
54068
|
+
const portFile = findPortFile(join123(appData, "Roam"));
|
|
54013
54069
|
if (!portFile) return;
|
|
54014
54070
|
let port;
|
|
54015
54071
|
try {
|
|
@@ -54160,11 +54216,11 @@ function findLinkIndex() {
|
|
|
54160
54216
|
function parseLinkArgs() {
|
|
54161
54217
|
const idx = findLinkIndex();
|
|
54162
54218
|
if (idx === -1) return null;
|
|
54163
|
-
const
|
|
54219
|
+
const path128 = process.argv[idx + 1];
|
|
54164
54220
|
const rest = process.argv.slice(idx + 2);
|
|
54165
54221
|
const { value: prefix2 } = extractOption(rest, "--prefix");
|
|
54166
54222
|
if (!prefix2) return null;
|
|
54167
|
-
return { path:
|
|
54223
|
+
return { path: path128, prefix: prefix2 };
|
|
54168
54224
|
}
|
|
54169
54225
|
function hasDuplicateLink(runList, linkPath) {
|
|
54170
54226
|
return runList.some(
|
|
@@ -54336,8 +54392,8 @@ function extractAddArgs(addIndex) {
|
|
|
54336
54392
|
const cwd = extractOption(filter.remaining, "--cwd");
|
|
54337
54393
|
const port = extractOption(cwd.remaining, "--port");
|
|
54338
54394
|
const protocol = extractOption(port.remaining, "--protocol");
|
|
54339
|
-
const
|
|
54340
|
-
const server = extractOptionalValueFlag(
|
|
54395
|
+
const path128 = extractOption(protocol.remaining, "--path");
|
|
54396
|
+
const server = extractOptionalValueFlag(path128.remaining, "--server");
|
|
54341
54397
|
const repo = extractOptionalValueFlag(server.remaining, "--repo");
|
|
54342
54398
|
return {
|
|
54343
54399
|
name: process.argv[addIndex + 1],
|
|
@@ -54348,7 +54404,7 @@ function extractAddArgs(addIndex) {
|
|
|
54348
54404
|
server: server.value,
|
|
54349
54405
|
port: parsePort(port.value),
|
|
54350
54406
|
protocol: parseProtocol(protocol.value),
|
|
54351
|
-
path:
|
|
54407
|
+
path: path128.value,
|
|
54352
54408
|
env: parseEnvPairs(env.values),
|
|
54353
54409
|
pre: pre.values.length > 0 ? pre.values : void 0,
|
|
54354
54410
|
filter: filter.value,
|
|
@@ -54368,11 +54424,11 @@ function requireParsedArgs() {
|
|
|
54368
54424
|
}
|
|
54369
54425
|
|
|
54370
54426
|
// src/commands/run/runCommandFilePath.ts
|
|
54371
|
-
import { join as
|
|
54427
|
+
import { join as join124 } from "path";
|
|
54372
54428
|
function runCommandFilePath(name2) {
|
|
54373
54429
|
const segments = name2.split(":");
|
|
54374
54430
|
const file = `${segments.pop()}.md`;
|
|
54375
|
-
return
|
|
54431
|
+
return join124(".claude", "commands", ...segments, file);
|
|
54376
54432
|
}
|
|
54377
54433
|
|
|
54378
54434
|
// src/commands/run/add.ts
|
|
@@ -54516,8 +54572,8 @@ function registerRunAdd(runCommand) {
|
|
|
54516
54572
|
}
|
|
54517
54573
|
|
|
54518
54574
|
// src/commands/run/remove.ts
|
|
54519
|
-
import { existsSync as
|
|
54520
|
-
import { dirname as dirname52, join as
|
|
54575
|
+
import { existsSync as existsSync100, readdirSync as readdirSync28, rmdirSync, unlinkSync as unlinkSync20 } from "fs";
|
|
54576
|
+
import { dirname as dirname52, join as join125 } from "path";
|
|
54521
54577
|
|
|
54522
54578
|
// src/commands/run/removeRepoRunConfig.ts
|
|
54523
54579
|
function isNamed(entry, name2) {
|
|
@@ -54535,19 +54591,19 @@ function removeRepoRunConfig(name2, repoName, cwd = process.cwd()) {
|
|
|
54535
54591
|
|
|
54536
54592
|
// src/commands/run/remove.ts
|
|
54537
54593
|
function removeEmptyNamespaceDirs(filePath) {
|
|
54538
|
-
const root2 =
|
|
54594
|
+
const root2 = join125(".claude", "commands");
|
|
54539
54595
|
for (let dir = dirname52(filePath); dir !== root2; dir = dirname52(dir)) {
|
|
54540
|
-
if (!
|
|
54596
|
+
if (!existsSync100(dir) || readdirSync28(dir).length > 0) return;
|
|
54541
54597
|
rmdirSync(dir);
|
|
54542
54598
|
}
|
|
54543
54599
|
}
|
|
54544
54600
|
function deleteCommandFile(name2) {
|
|
54545
54601
|
const filePath = runCommandFilePath(name2);
|
|
54546
|
-
const legacyPath =
|
|
54547
|
-
for (const
|
|
54548
|
-
if (
|
|
54549
|
-
unlinkSync20(
|
|
54550
|
-
console.log(`Deleted command file: ${
|
|
54602
|
+
const legacyPath = join125(".claude", "commands", `${name2}.md`);
|
|
54603
|
+
for (const path128 of /* @__PURE__ */ new Set([filePath, legacyPath])) {
|
|
54604
|
+
if (existsSync100(path128)) {
|
|
54605
|
+
unlinkSync20(path128);
|
|
54606
|
+
console.log(`Deleted command file: ${path128}`);
|
|
54551
54607
|
}
|
|
54552
54608
|
}
|
|
54553
54609
|
removeEmptyNamespaceDirs(filePath);
|
|
@@ -55283,12 +55339,12 @@ function toSessionViewInfo({
|
|
|
55283
55339
|
}
|
|
55284
55340
|
|
|
55285
55341
|
// src/commands/sessions/daemon/worktree/joinRefusal.ts
|
|
55286
|
-
import { existsSync as
|
|
55342
|
+
import { existsSync as existsSync101 } from "fs";
|
|
55287
55343
|
function joinRefusal(session) {
|
|
55288
55344
|
if (session.commandType === "run") return "a server run has no agent stream";
|
|
55289
55345
|
if (session.closing === true) return "the session is closing";
|
|
55290
55346
|
if (!session.cwd) return "the session has no working directory";
|
|
55291
|
-
if (!
|
|
55347
|
+
if (!existsSync101(session.cwd))
|
|
55292
55348
|
return "the session's workspace no longer exists";
|
|
55293
55349
|
return void 0;
|
|
55294
55350
|
}
|
|
@@ -55378,8 +55434,8 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
|
|
|
55378
55434
|
}
|
|
55379
55435
|
|
|
55380
55436
|
// src/commands/sessions/daemon/findServerParents.ts
|
|
55381
|
-
import { existsSync as
|
|
55382
|
-
import { join as
|
|
55437
|
+
import { existsSync as existsSync102 } from "fs";
|
|
55438
|
+
import { join as join126, resolve as resolve33 } from "path";
|
|
55383
55439
|
function isLive(session) {
|
|
55384
55440
|
return !!session.pty && session.status !== "done" && session.status !== "error";
|
|
55385
55441
|
}
|
|
@@ -55388,7 +55444,7 @@ function isLiveAgent(session) {
|
|
|
55388
55444
|
}
|
|
55389
55445
|
function serverRunDirs(sessions, file) {
|
|
55390
55446
|
return new Set(
|
|
55391
|
-
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve33(s.cwd)).filter((dir) =>
|
|
55447
|
+
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve33(s.cwd)).filter((dir) => existsSync102(join126(dir, file)))
|
|
55392
55448
|
);
|
|
55393
55449
|
}
|
|
55394
55450
|
function findServerParents(sessions, file) {
|
|
@@ -55399,8 +55455,8 @@ function findServerParents(sessions, file) {
|
|
|
55399
55455
|
|
|
55400
55456
|
// src/commands/sessions/daemon/lastWriteTimes.ts
|
|
55401
55457
|
import { isAbsolute as isAbsolute8, resolve as resolve34 } from "path";
|
|
55402
|
-
function normalise2(
|
|
55403
|
-
const absolute2 = cwd && !isAbsolute8(
|
|
55458
|
+
function normalise2(path128, cwd) {
|
|
55459
|
+
const absolute2 = cwd && !isAbsolute8(path128) ? resolve34(cwd, path128) : path128;
|
|
55404
55460
|
return absolute2.replaceAll("\\", "/");
|
|
55405
55461
|
}
|
|
55406
55462
|
function latest(current2, at2) {
|
|
@@ -55417,10 +55473,10 @@ function lastWriteTimes(events, target, cwd) {
|
|
|
55417
55473
|
for (const event of events) {
|
|
55418
55474
|
const at2 = Date.parse(String(event.at));
|
|
55419
55475
|
if (Number.isNaN(at2)) continue;
|
|
55420
|
-
for (const
|
|
55421
|
-
if (
|
|
55476
|
+
for (const path128 of writtenPaths(event).map((p) => normalise2(p, cwd))) {
|
|
55477
|
+
if (path128.endsWith(`/${target.file}`))
|
|
55422
55478
|
result.file = latest(result.file, at2);
|
|
55423
|
-
if (
|
|
55479
|
+
if (path128.includes(`/${target.within}`))
|
|
55424
55480
|
result.within = latest(result.within, at2);
|
|
55425
55481
|
}
|
|
55426
55482
|
}
|
|
@@ -56016,7 +56072,7 @@ var ClientHub = class extends Set {
|
|
|
56016
56072
|
};
|
|
56017
56073
|
|
|
56018
56074
|
// src/commands/sessions/daemon/autoUpdate/autoUpdateControl.ts
|
|
56019
|
-
import { existsSync as
|
|
56075
|
+
import { existsSync as existsSync103, rmSync as rmSync16, writeFileSync as writeFileSync62 } from "fs";
|
|
56020
56076
|
var paused;
|
|
56021
56077
|
var wake;
|
|
56022
56078
|
var holdReleased = false;
|
|
@@ -56029,7 +56085,7 @@ function persist2(value) {
|
|
|
56029
56085
|
}
|
|
56030
56086
|
var autoUpdateControl = {
|
|
56031
56087
|
paused: () => {
|
|
56032
|
-
paused ??=
|
|
56088
|
+
paused ??= existsSync103(daemonPaths.autoUpdatePaused);
|
|
56033
56089
|
return paused;
|
|
56034
56090
|
},
|
|
56035
56091
|
setPaused: (value) => {
|
|
@@ -56183,16 +56239,16 @@ import { readFileSync as readFileSync88, writeFileSync as writeFileSync63 } from
|
|
|
56183
56239
|
var KEEP_TAIL = 256 * 1024;
|
|
56184
56240
|
var MAX_LOG_SIZE = 4 * 1024 * 1024;
|
|
56185
56241
|
function trimWatcherLog(cwd) {
|
|
56186
|
-
const
|
|
56242
|
+
const path128 = watcherLogPath(cwd);
|
|
56187
56243
|
let log2;
|
|
56188
56244
|
try {
|
|
56189
|
-
log2 = readFileSync88(
|
|
56245
|
+
log2 = readFileSync88(path128, "utf8");
|
|
56190
56246
|
} catch {
|
|
56191
56247
|
return;
|
|
56192
56248
|
}
|
|
56193
56249
|
if (log2.length <= MAX_LOG_SIZE) return;
|
|
56194
|
-
writeFileSync63(
|
|
56195
|
-
daemonLog(`auto-update: log ${
|
|
56250
|
+
writeFileSync63(path128, log2.slice(-KEEP_TAIL));
|
|
56251
|
+
daemonLog(`auto-update: log ${path128} trimmed to its last ${KEEP_TAIL} chars`);
|
|
56196
56252
|
}
|
|
56197
56253
|
|
|
56198
56254
|
// src/commands/sessions/daemon/worktree/appendWatcherLog.ts
|
|
@@ -56200,20 +56256,20 @@ import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync42 } from "fs"
|
|
|
56200
56256
|
import { dirname as dirname53 } from "path";
|
|
56201
56257
|
function appendWatcherLog(cwd, data) {
|
|
56202
56258
|
try {
|
|
56203
|
-
const
|
|
56204
|
-
mkdirSync42(dirname53(
|
|
56205
|
-
appendFileSync4(
|
|
56259
|
+
const path128 = watcherLogPath(cwd);
|
|
56260
|
+
mkdirSync42(dirname53(path128), { recursive: true });
|
|
56261
|
+
appendFileSync4(path128, data);
|
|
56206
56262
|
} catch {
|
|
56207
56263
|
}
|
|
56208
56264
|
}
|
|
56209
56265
|
|
|
56210
56266
|
// src/commands/sessions/daemon/designSystemPromptPath.ts
|
|
56211
|
-
import * as
|
|
56267
|
+
import * as path127 from "path";
|
|
56212
56268
|
import { fileURLToPath as fileURLToPath11 } from "url";
|
|
56213
56269
|
var __filename6 = fileURLToPath11(import.meta.url);
|
|
56214
|
-
var __dirname7 =
|
|
56270
|
+
var __dirname7 = path127.dirname(__filename6);
|
|
56215
56271
|
function designSystemPromptPath() {
|
|
56216
|
-
return
|
|
56272
|
+
return path127.join(__dirname7, "..", "claude", "design-system-prompt.md");
|
|
56217
56273
|
}
|
|
56218
56274
|
|
|
56219
56275
|
// src/commands/sessions/daemon/sessionModeLaunch.ts
|
|
@@ -56300,27 +56356,27 @@ function detectExistingWorktree(cwd) {
|
|
|
56300
56356
|
|
|
56301
56357
|
// src/commands/sessions/daemon/worktree/noteWorktreeHarness.ts
|
|
56302
56358
|
function noteWorktreeHarness(session) {
|
|
56303
|
-
const
|
|
56304
|
-
if (!
|
|
56359
|
+
const path128 = session.worktree?.path;
|
|
56360
|
+
if (!path128) return;
|
|
56305
56361
|
const harness = session.commandType === "claude" ? resolveHarness(session.harness) : session.harness;
|
|
56306
56362
|
if (!harness) return;
|
|
56307
56363
|
try {
|
|
56308
|
-
recordWorktreeHarness(
|
|
56364
|
+
recordWorktreeHarness(path128, harness);
|
|
56309
56365
|
} catch (error) {
|
|
56310
56366
|
daemonLog(
|
|
56311
|
-
`worktree ${
|
|
56367
|
+
`worktree ${path128} harness ${harness} not recorded for session ${session.id}: ${error instanceof Error ? error.message : String(error)}`
|
|
56312
56368
|
);
|
|
56313
56369
|
}
|
|
56314
56370
|
}
|
|
56315
56371
|
|
|
56316
56372
|
// src/commands/sessions/daemon/worktree/refuseUnallocatedStart.ts
|
|
56317
|
-
function refuseUnallocatedStart(session,
|
|
56373
|
+
function refuseUnallocatedStart(session, path128, error, startHeld) {
|
|
56318
56374
|
const reason4 = error instanceof Error ? error.message : String(error);
|
|
56319
56375
|
daemonLog(
|
|
56320
|
-
`session ${session.id} worktree ${
|
|
56376
|
+
`session ${session.id} worktree ${path128} could not be created: ${reason4}`
|
|
56321
56377
|
);
|
|
56322
56378
|
session.pendingStart = () => {
|
|
56323
|
-
throw new Error(`worktree ${
|
|
56379
|
+
throw new Error(`worktree ${path128} could not be created: ${reason4}`);
|
|
56324
56380
|
};
|
|
56325
56381
|
startHeld(session);
|
|
56326
56382
|
}
|
|
@@ -56342,9 +56398,9 @@ function bindNewWorktree(session, alloc, notify2, startHeld = () => {
|
|
|
56342
56398
|
}
|
|
56343
56399
|
notify2();
|
|
56344
56400
|
}
|
|
56345
|
-
function seedHeldSession(session,
|
|
56401
|
+
function seedHeldSession(session, path128, clone, notify2, startHeld) {
|
|
56346
56402
|
seedWorktree(
|
|
56347
|
-
|
|
56403
|
+
path128,
|
|
56348
56404
|
clone,
|
|
56349
56405
|
() => {
|
|
56350
56406
|
session.seeding = void 0;
|
|
@@ -56372,13 +56428,13 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
56372
56428
|
}
|
|
56373
56429
|
|
|
56374
56430
|
// src/commands/sessions/daemon/worktree/treeDurability.ts
|
|
56375
|
-
import { existsSync as
|
|
56431
|
+
import { existsSync as existsSync105 } from "fs";
|
|
56376
56432
|
|
|
56377
56433
|
// src/commands/sessions/daemon/worktree/holdsNoCheckout.ts
|
|
56378
|
-
import { existsSync as
|
|
56379
|
-
import { join as
|
|
56380
|
-
function holdsNoCheckout(
|
|
56381
|
-
return
|
|
56434
|
+
import { existsSync as existsSync104 } from "fs";
|
|
56435
|
+
import { join as join128 } from "path";
|
|
56436
|
+
function holdsNoCheckout(path128) {
|
|
56437
|
+
return existsSync104(path128) && !existsSync104(join128(path128, ".git"));
|
|
56382
56438
|
}
|
|
56383
56439
|
|
|
56384
56440
|
// src/commands/sessions/daemon/worktree/treeDurability.ts
|
|
@@ -56416,14 +56472,14 @@ function notACheckout(cwd, error) {
|
|
|
56416
56472
|
return holdsNoCheckout(cwd) && /not a git repository/i.test(error);
|
|
56417
56473
|
}
|
|
56418
56474
|
async function checkDurability(cwd) {
|
|
56419
|
-
if (!
|
|
56475
|
+
if (!existsSync105(cwd)) return treeIsGone;
|
|
56420
56476
|
const probes = durabilityProbes(cwd);
|
|
56421
56477
|
let step3 = probes.next();
|
|
56422
56478
|
while (!step3.done) step3 = probes.next(await gitResult(cwd, step3.value));
|
|
56423
56479
|
return step3.value;
|
|
56424
56480
|
}
|
|
56425
56481
|
function checkDurabilitySync(cwd) {
|
|
56426
|
-
if (!
|
|
56482
|
+
if (!existsSync105(cwd)) return treeIsGone;
|
|
56427
56483
|
const probes = durabilityProbes(cwd);
|
|
56428
56484
|
let step3 = probes.next();
|
|
56429
56485
|
while (!step3.done) step3 = probes.next(gitSyncResult(cwd, step3.value));
|
|
@@ -56585,8 +56641,8 @@ import { rmSync as rmSync17 } from "fs";
|
|
|
56585
56641
|
function clearLapSignals(cwd) {
|
|
56586
56642
|
const control = watchControlPaths(cwd);
|
|
56587
56643
|
if (!control) return;
|
|
56588
|
-
for (const
|
|
56589
|
-
rmSync17(
|
|
56644
|
+
for (const path128 of [control.check, control.stop])
|
|
56645
|
+
rmSync17(path128, { force: true });
|
|
56590
56646
|
}
|
|
56591
56647
|
function runUpdateLap(cwd, onOutput) {
|
|
56592
56648
|
clearLapSignals(cwd);
|
|
@@ -56716,17 +56772,17 @@ function setStatus2(session, newStatus) {
|
|
|
56716
56772
|
}
|
|
56717
56773
|
|
|
56718
56774
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
56719
|
-
import { existsSync as
|
|
56775
|
+
import { existsSync as existsSync107 } from "fs";
|
|
56720
56776
|
import { basename as basename34 } from "path";
|
|
56721
56777
|
|
|
56722
56778
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
56723
|
-
import { existsSync as
|
|
56724
|
-
import { join as
|
|
56779
|
+
import { existsSync as existsSync106 } from "fs";
|
|
56780
|
+
import { join as join130 } from "path";
|
|
56725
56781
|
|
|
56726
56782
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
56727
|
-
import { statSync as
|
|
56783
|
+
import { statSync as statSync19 } from "fs";
|
|
56728
56784
|
import { rm as rm3 } from "fs/promises";
|
|
56729
|
-
import { join as
|
|
56785
|
+
import { join as join129 } from "path";
|
|
56730
56786
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
56731
56787
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
56732
56788
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -56755,7 +56811,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
56755
56811
|
return { removed: true };
|
|
56756
56812
|
}
|
|
56757
56813
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
56758
|
-
return
|
|
56814
|
+
return statSync19(join129(worktreePath, ".git"), {
|
|
56759
56815
|
throwIfNoEntry: false
|
|
56760
56816
|
})?.isDirectory() === true;
|
|
56761
56817
|
}
|
|
@@ -56796,7 +56852,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
56796
56852
|
);
|
|
56797
56853
|
}
|
|
56798
56854
|
function strandedReason(worktreePath, cause) {
|
|
56799
|
-
if (!
|
|
56855
|
+
if (!existsSync106(join130(worktreePath, ".git")))
|
|
56800
56856
|
return "its .git link is already gone";
|
|
56801
56857
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
56802
56858
|
return "git no longer recognises it as a working tree";
|
|
@@ -56848,7 +56904,7 @@ function reason3(error) {
|
|
|
56848
56904
|
|
|
56849
56905
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
56850
56906
|
async function reapWorktree(worktreePath, force = false) {
|
|
56851
|
-
if (!
|
|
56907
|
+
if (!existsSync107(worktreePath)) {
|
|
56852
56908
|
forgetWorktree(worktreePath);
|
|
56853
56909
|
daemonLog(
|
|
56854
56910
|
`worktree ${worktreePath} already gone; its record was forgotten`
|
|
@@ -56873,7 +56929,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
56873
56929
|
}
|
|
56874
56930
|
function owningClone(worktreePath) {
|
|
56875
56931
|
const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
|
|
56876
|
-
if (recorded &&
|
|
56932
|
+
if (recorded && existsSync107(recorded)) return recorded;
|
|
56877
56933
|
const detected = mainWorktree(worktreePath);
|
|
56878
56934
|
if (detected) return detected;
|
|
56879
56935
|
daemonLog(
|
|
@@ -56923,11 +56979,11 @@ function holdFailedDiscard(session, reason4, notify2) {
|
|
|
56923
56979
|
notify2();
|
|
56924
56980
|
}
|
|
56925
56981
|
function releaseUndeletableLeftover(session, reason4, notify2) {
|
|
56926
|
-
const
|
|
56982
|
+
const path128 = session.worktree?.path;
|
|
56927
56983
|
daemonLog(
|
|
56928
|
-
`session ${session.id} discard could not delete ${
|
|
56984
|
+
`session ${session.id} discard could not delete ${path128}, which holds no git checkout and so no work: ${reason4}; card released to error so it can be dismissed`
|
|
56929
56985
|
);
|
|
56930
|
-
const message4 = `Discard could not delete ${
|
|
56986
|
+
const message4 = `Discard could not delete ${path128}: ${reason4}`;
|
|
56931
56987
|
if (session.worktree) session.releasedFromClone = session.worktree.clone;
|
|
56932
56988
|
session.worktree = void 0;
|
|
56933
56989
|
session.closing = void 0;
|
|
@@ -57154,7 +57210,7 @@ function underVsCode(pid, procRoot) {
|
|
|
57154
57210
|
let current2 = pid;
|
|
57155
57211
|
for (let depth = 0; current2 && current2 > 1 && depth < MAX_ANCESTORS; depth++) {
|
|
57156
57212
|
const cmdline = readProc(procRoot, current2, "cmdline");
|
|
57157
|
-
if (cmdline && VSCODE_PATHS.some((
|
|
57213
|
+
if (cmdline && VSCODE_PATHS.some((path128) => cmdline.includes(path128)))
|
|
57158
57214
|
return true;
|
|
57159
57215
|
current2 = parentPid(readProc(procRoot, current2, "stat"));
|
|
57160
57216
|
}
|
|
@@ -57190,12 +57246,12 @@ async function closeBlockReason(sessionId2, tree) {
|
|
|
57190
57246
|
}
|
|
57191
57247
|
|
|
57192
57248
|
// src/commands/sessions/daemon/worktree/watchGitState.ts
|
|
57193
|
-
import { existsSync as
|
|
57249
|
+
import { existsSync as existsSync108, watch } from "fs";
|
|
57194
57250
|
var DEBOUNCE_MS = 500;
|
|
57195
57251
|
var POLL_MS5 = 3e4;
|
|
57196
57252
|
function watchGitState(cwd, onChange) {
|
|
57197
57253
|
const common = gitCommonDir(cwd);
|
|
57198
|
-
if (!common || !
|
|
57254
|
+
if (!common || !existsSync108(common)) return void 0;
|
|
57199
57255
|
const watchers = [
|
|
57200
57256
|
watchGitDir(common, onChange),
|
|
57201
57257
|
pollGitState(cwd, onChange)
|
|
@@ -57959,7 +58015,7 @@ function emitSessionOutput(session, clients, data) {
|
|
|
57959
58015
|
}
|
|
57960
58016
|
|
|
57961
58017
|
// src/commands/sessions/daemon/exitReason.ts
|
|
57962
|
-
import { existsSync as
|
|
58018
|
+
import { existsSync as existsSync109 } from "fs";
|
|
57963
58019
|
import { resolve as resolve35 } from "path";
|
|
57964
58020
|
|
|
57965
58021
|
// src/commands/sessions/daemon/resolveRunConfig.ts
|
|
@@ -57978,7 +58034,7 @@ function resolveRunConfig(name2, cwd) {
|
|
|
57978
58034
|
|
|
57979
58035
|
// src/commands/sessions/daemon/exitReason.ts
|
|
57980
58036
|
function exitDetail(session) {
|
|
57981
|
-
if (session.cwd && !
|
|
58037
|
+
if (session.cwd && !existsSync109(session.cwd))
|
|
57982
58038
|
return `working directory ${session.cwd} no longer exists`;
|
|
57983
58039
|
return missingRunConfigCwd(session);
|
|
57984
58040
|
}
|
|
@@ -57992,7 +58048,7 @@ function missingRunConfigCwd(session) {
|
|
|
57992
58048
|
const config = resolveRunConfig(session.runName, dir);
|
|
57993
58049
|
if (!config?.cwd) return void 0;
|
|
57994
58050
|
const configured = resolve35(runConfigBaseDirFrom(dir), config.cwd);
|
|
57995
|
-
if (
|
|
58051
|
+
if (existsSync109(configured)) return void 0;
|
|
57996
58052
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
57997
58053
|
}
|
|
57998
58054
|
|
|
@@ -58040,7 +58096,7 @@ function handleRefusedRun(session, exitCode, onStatusChange) {
|
|
|
58040
58096
|
}
|
|
58041
58097
|
|
|
58042
58098
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
58043
|
-
import { existsSync as
|
|
58099
|
+
import { existsSync as existsSync110, mkdirSync as mkdirSync43, watch as watch2 } from "fs";
|
|
58044
58100
|
import { dirname as dirname55 } from "path";
|
|
58045
58101
|
|
|
58046
58102
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
@@ -58224,8 +58280,8 @@ async function seedRunningMsFromUsage(session, notify2) {
|
|
|
58224
58280
|
var DEBOUNCE_MS2 = 50;
|
|
58225
58281
|
function watchActivity(session, notify2, onConversation) {
|
|
58226
58282
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
58227
|
-
const
|
|
58228
|
-
const dir = dirname55(
|
|
58283
|
+
const path128 = activityPath(session.id);
|
|
58284
|
+
const dir = dirname55(path128);
|
|
58229
58285
|
try {
|
|
58230
58286
|
mkdirSync43(dir, { recursive: true });
|
|
58231
58287
|
} catch {
|
|
@@ -58235,7 +58291,7 @@ function watchActivity(session, notify2, onConversation) {
|
|
|
58235
58291
|
let timer = null;
|
|
58236
58292
|
const read4 = () => {
|
|
58237
58293
|
timer = null;
|
|
58238
|
-
const activity2 = readActivity(
|
|
58294
|
+
const activity2 = readActivity(path128);
|
|
58239
58295
|
if (!activity2) return;
|
|
58240
58296
|
applyLaunchActivity(session, activity2, notify2, onConversation);
|
|
58241
58297
|
if (activity2.claudeSessionId) onConversation?.(session);
|
|
@@ -58244,11 +58300,11 @@ function watchActivity(session, notify2, onConversation) {
|
|
|
58244
58300
|
notify2();
|
|
58245
58301
|
};
|
|
58246
58302
|
session.activityWatcher = watch2(dir, (_event, filename) => {
|
|
58247
|
-
if (filename && !
|
|
58303
|
+
if (filename && !path128.endsWith(filename)) return;
|
|
58248
58304
|
if (timer) clearTimeout(timer);
|
|
58249
58305
|
timer = setTimeout(read4, DEBOUNCE_MS2);
|
|
58250
58306
|
});
|
|
58251
|
-
if (
|
|
58307
|
+
if (existsSync110(path128)) read4();
|
|
58252
58308
|
}
|
|
58253
58309
|
function refreshActivity(session) {
|
|
58254
58310
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -58637,7 +58693,7 @@ function makeSessionSpawner(sessions, clients, counter, onStatusChange, notify2)
|
|
|
58637
58693
|
}
|
|
58638
58694
|
|
|
58639
58695
|
// src/commands/sessions/shared/transcriptUsage.ts
|
|
58640
|
-
import * as
|
|
58696
|
+
import * as fs71 from "fs";
|
|
58641
58697
|
function transcriptUsage(lines) {
|
|
58642
58698
|
const byId = /* @__PURE__ */ new Map();
|
|
58643
58699
|
for (const line of lines) {
|
|
@@ -58661,7 +58717,7 @@ function transcriptUsage(lines) {
|
|
|
58661
58717
|
return [...byId.values()];
|
|
58662
58718
|
}
|
|
58663
58719
|
async function readTranscriptUsage(transcriptPath) {
|
|
58664
|
-
const content = await
|
|
58720
|
+
const content = await fs71.promises.readFile(transcriptPath, "utf8");
|
|
58665
58721
|
return transcriptUsage(content.split("\n"));
|
|
58666
58722
|
}
|
|
58667
58723
|
|
|
@@ -59030,13 +59086,13 @@ var WIP_COMMIT = [
|
|
|
59030
59086
|
"-m",
|
|
59031
59087
|
"assist transfer WIP"
|
|
59032
59088
|
];
|
|
59033
|
-
async function currentBranch6(
|
|
59034
|
-
const branch2 = await gitOrNull(
|
|
59089
|
+
async function currentBranch6(path128, treeRoot) {
|
|
59090
|
+
const branch2 = await gitOrNull(path128, ["symbolic-ref", "--short", "HEAD"]);
|
|
59035
59091
|
if (!branch2 || treeRoot && branch2 === basename35(treeRoot)) return void 0;
|
|
59036
59092
|
return branch2;
|
|
59037
59093
|
}
|
|
59038
|
-
async function upstreamBranch2(
|
|
59039
|
-
const upstream = await gitOrNull(
|
|
59094
|
+
async function upstreamBranch2(path128) {
|
|
59095
|
+
const upstream = await gitOrNull(path128, [
|
|
59040
59096
|
"rev-parse",
|
|
59041
59097
|
"--abbrev-ref",
|
|
59042
59098
|
"--symbolic-full-name",
|
|
@@ -59045,32 +59101,32 @@ async function upstreamBranch2(path126) {
|
|
|
59045
59101
|
if (!upstream?.startsWith("origin/")) return void 0;
|
|
59046
59102
|
return upstream.slice("origin/".length);
|
|
59047
59103
|
}
|
|
59048
|
-
async function pushTransferSnapshot(
|
|
59104
|
+
async function pushTransferSnapshot(path128, itemId2, treeRoot) {
|
|
59049
59105
|
const ref = transferRefFor(itemId2);
|
|
59050
|
-
const branch2 = await currentBranch6(
|
|
59051
|
-
const upstream = await upstreamBranch2(
|
|
59052
|
-
const head = (await git2(
|
|
59053
|
-
await git2(
|
|
59106
|
+
const branch2 = await currentBranch6(path128, treeRoot);
|
|
59107
|
+
const upstream = await upstreamBranch2(path128);
|
|
59108
|
+
const head = (await git2(path128, ["rev-parse", "HEAD"])).trim();
|
|
59109
|
+
await git2(path128, ["add", "-A"]);
|
|
59054
59110
|
try {
|
|
59055
|
-
await git2(
|
|
59111
|
+
await git2(path128, WIP_COMMIT);
|
|
59056
59112
|
await git2(
|
|
59057
|
-
|
|
59113
|
+
path128,
|
|
59058
59114
|
["push", "--no-verify", "--force", "origin", `HEAD:refs/heads/${ref}`],
|
|
59059
59115
|
PUSH_TIMEOUT_MS
|
|
59060
59116
|
);
|
|
59061
59117
|
} finally {
|
|
59062
|
-
await git2(
|
|
59118
|
+
await git2(path128, ["reset", "--mixed", "--quiet", head]);
|
|
59063
59119
|
}
|
|
59064
59120
|
return { ref, branch: branch2, upstream };
|
|
59065
59121
|
}
|
|
59066
59122
|
|
|
59067
59123
|
// src/commands/sessions/daemon/transfer/snapshotTree.ts
|
|
59068
59124
|
async function snapshotTree(s, args, traceId) {
|
|
59069
|
-
const
|
|
59070
|
-
if (!
|
|
59071
|
-
const snapshot2 = await pushTransferSnapshot(
|
|
59125
|
+
const path128 = s.worktree?.path ?? s.cwd;
|
|
59126
|
+
if (!path128) return void 0;
|
|
59127
|
+
const snapshot2 = await pushTransferSnapshot(path128, args[2], s.worktree?.path);
|
|
59072
59128
|
daemonLog(
|
|
59073
|
-
`session ${s.id} pushed ${
|
|
59129
|
+
`session ${s.id} pushed ${path128} to ${snapshot2.ref} (branch=${snapshot2.branch ?? "tree"} upstream=${snapshot2.upstream ?? "none"}) trace=${traceId}`
|
|
59074
59130
|
);
|
|
59075
59131
|
return snapshot2;
|
|
59076
59132
|
}
|
|
@@ -59672,9 +59728,9 @@ function tempRoots() {
|
|
|
59672
59728
|
}
|
|
59673
59729
|
return [...roots];
|
|
59674
59730
|
}
|
|
59675
|
-
function underTempRoot(
|
|
59731
|
+
function underTempRoot(path128) {
|
|
59676
59732
|
return tempRoots().some(
|
|
59677
|
-
(root2) =>
|
|
59733
|
+
(root2) => path128.startsWith(root2.endsWith(sep7) ? root2 : root2 + sep7)
|
|
59678
59734
|
);
|
|
59679
59735
|
}
|
|
59680
59736
|
|
|
@@ -60193,7 +60249,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
60193
60249
|
}
|
|
60194
60250
|
|
|
60195
60251
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
60196
|
-
import { existsSync as
|
|
60252
|
+
import { existsSync as existsSync112 } from "fs";
|
|
60197
60253
|
import { basename as basename37 } from "path";
|
|
60198
60254
|
|
|
60199
60255
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
@@ -60214,18 +60270,18 @@ function accountedTrees(sessions) {
|
|
|
60214
60270
|
}
|
|
60215
60271
|
|
|
60216
60272
|
// src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
|
|
60217
|
-
import { existsSync as
|
|
60273
|
+
import { existsSync as existsSync111 } from "fs";
|
|
60218
60274
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
60219
|
-
if (!
|
|
60220
|
-
for (const { path:
|
|
60275
|
+
if (!existsSync111(clone)) {
|
|
60276
|
+
for (const { path: path128 } of paths) forgetWorktree(path128);
|
|
60221
60277
|
daemonLog(
|
|
60222
60278
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
60223
60279
|
);
|
|
60224
60280
|
return;
|
|
60225
60281
|
}
|
|
60226
60282
|
await pruneBookkeeping2(clone);
|
|
60227
|
-
for (const { path:
|
|
60228
|
-
if (await reclaimBranch(clone, branch2)) forgetWorktree(
|
|
60283
|
+
for (const { path: path128, branch: branch2 } of paths)
|
|
60284
|
+
if (await reclaimBranch(clone, branch2)) forgetWorktree(path128);
|
|
60229
60285
|
}
|
|
60230
60286
|
async function pruneBookkeeping2(clone) {
|
|
60231
60287
|
try {
|
|
@@ -60252,37 +60308,37 @@ async function reclaimBranch(clone, branch2) {
|
|
|
60252
60308
|
}
|
|
60253
60309
|
|
|
60254
60310
|
// src/commands/sessions/daemon/worktree/logVanishedTree.ts
|
|
60255
|
-
function logVanishedTree(sessions,
|
|
60311
|
+
function logVanishedTree(sessions, path128) {
|
|
60256
60312
|
const claimants = [...sessions.values()].filter(
|
|
60257
|
-
(s) => s.cwd ===
|
|
60313
|
+
(s) => s.cwd === path128 || s.worktree?.path === path128
|
|
60258
60314
|
);
|
|
60259
60315
|
if (claimants.length === 0) {
|
|
60260
|
-
daemonLog(`worktree ${
|
|
60316
|
+
daemonLog(`worktree ${path128} gone from disk and unclaimed; reclaiming it`);
|
|
60261
60317
|
return;
|
|
60262
60318
|
}
|
|
60263
60319
|
for (const s of claimants)
|
|
60264
60320
|
daemonLog(
|
|
60265
|
-
`session ${s.id} ("${s.name}") claims worktree ${
|
|
60321
|
+
`session ${s.id} ("${s.name}") claims worktree ${path128}, which is gone from disk; reclaiming it`
|
|
60266
60322
|
);
|
|
60267
60323
|
}
|
|
60268
60324
|
|
|
60269
60325
|
// src/commands/sessions/daemon/worktree/describeHeldWork.ts
|
|
60270
60326
|
var MAX_ITEMS = 20;
|
|
60271
|
-
async function describeHeldWork(
|
|
60272
|
-
if (reason4.startsWith("uncommitted")) return await changedFiles(
|
|
60273
|
-
if (reason4.startsWith("unpushed")) return await unpushedCommits(
|
|
60327
|
+
async function describeHeldWork(path128, reason4) {
|
|
60328
|
+
if (reason4.startsWith("uncommitted")) return await changedFiles(path128);
|
|
60329
|
+
if (reason4.startsWith("unpushed")) return await unpushedCommits(path128, reason4);
|
|
60274
60330
|
return { summary: reason4, items: [] };
|
|
60275
60331
|
}
|
|
60276
|
-
async function changedFiles(
|
|
60277
|
-
const status2 = await gitResult(
|
|
60332
|
+
async function changedFiles(path128) {
|
|
60333
|
+
const status2 = await gitResult(path128, ["status", "--porcelain"]);
|
|
60278
60334
|
const lines = status2.ok ? nonEmptyLines(status2.out) : [];
|
|
60279
60335
|
return {
|
|
60280
60336
|
summary: `${lines.length} uncommitted ${lines.length === 1 ? "file" : "files"}`,
|
|
60281
60337
|
items: capped2(lines)
|
|
60282
60338
|
};
|
|
60283
60339
|
}
|
|
60284
|
-
async function unpushedCommits(
|
|
60285
|
-
const log2 = await gitResult(
|
|
60340
|
+
async function unpushedCommits(path128, reason4) {
|
|
60341
|
+
const log2 = await gitResult(path128, ["log", "--oneline", "@{upstream}..HEAD"]);
|
|
60286
60342
|
if (!log2.ok) return { summary: reason4, items: [] };
|
|
60287
60343
|
const lines = nonEmptyLines(log2.out);
|
|
60288
60344
|
return {
|
|
@@ -60375,24 +60431,24 @@ function reconcileWorktreesOnRestore(sessions, spawnWith, notify2) {
|
|
|
60375
60431
|
async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
60376
60432
|
const accounted = accountedTrees(sessions);
|
|
60377
60433
|
const vanished = /* @__PURE__ */ new Map();
|
|
60378
|
-
for (const { path:
|
|
60379
|
-
if (underTempRoot(
|
|
60380
|
-
forgetWorktree(
|
|
60434
|
+
for (const { path: path128, clone, harness } of readWorktreeRegistry()) {
|
|
60435
|
+
if (underTempRoot(path128)) {
|
|
60436
|
+
forgetWorktree(path128);
|
|
60381
60437
|
daemonLog(
|
|
60382
|
-
`worktree ${
|
|
60438
|
+
`worktree ${path128} lies outside any project root; pruned from the registry rather than recovered`
|
|
60383
60439
|
);
|
|
60384
60440
|
continue;
|
|
60385
60441
|
}
|
|
60386
|
-
if (!
|
|
60387
|
-
logVanishedTree(sessions,
|
|
60442
|
+
if (!existsSync112(path128)) {
|
|
60443
|
+
logVanishedTree(sessions, path128);
|
|
60388
60444
|
vanished.set(clone, [
|
|
60389
60445
|
...vanished.get(clone) ?? [],
|
|
60390
|
-
{ path:
|
|
60446
|
+
{ path: path128, branch: basename37(path128) }
|
|
60391
60447
|
]);
|
|
60392
60448
|
continue;
|
|
60393
60449
|
}
|
|
60394
|
-
if (accounted.has(
|
|
60395
|
-
await recoverOrphan(sessions, spawnWith, { path:
|
|
60450
|
+
if (accounted.has(path128)) continue;
|
|
60451
|
+
await recoverOrphan(sessions, spawnWith, { path: path128, clone, harness }, notify2);
|
|
60396
60452
|
}
|
|
60397
60453
|
for (const [clone, paths] of vanished)
|
|
60398
60454
|
await reclaimVanishedWorktrees(clone, paths);
|
|
@@ -60410,13 +60466,13 @@ function startHeldInTree(seeded, sessions, clients, onStatusChange, notify2) {
|
|
|
60410
60466
|
// src/commands/sessions/daemon/worktree/reseedRestoredWorktrees.ts
|
|
60411
60467
|
function reseedRestoredWorktrees(deps2) {
|
|
60412
60468
|
const { sessions, clients, onStatusChange, notify: notify2 } = deps2;
|
|
60413
|
-
for (const [
|
|
60469
|
+
for (const [path128, { session, clone }] of heldTrees(sessions)) {
|
|
60414
60470
|
daemonLog(
|
|
60415
|
-
`session ${session.id} ("${session.name}") restored mid worktree setup; re-seeding ${
|
|
60471
|
+
`session ${session.id} ("${session.name}") restored mid worktree setup; re-seeding ${path128} before starting it`
|
|
60416
60472
|
);
|
|
60417
60473
|
seedHeldSession(
|
|
60418
60474
|
session,
|
|
60419
|
-
|
|
60475
|
+
path128,
|
|
60420
60476
|
clone,
|
|
60421
60477
|
notify2,
|
|
60422
60478
|
(seeded) => startHeldInTree(seeded, sessions, clients, onStatusChange, notify2)
|
|
@@ -61657,7 +61713,7 @@ function spawnAssistInTree(ctx, assistArgs, cwd, meta, context) {
|
|
|
61657
61713
|
}
|
|
61658
61714
|
|
|
61659
61715
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
61660
|
-
import { existsSync as
|
|
61716
|
+
import { existsSync as existsSync114 } from "fs";
|
|
61661
61717
|
|
|
61662
61718
|
// src/commands/sessions/daemon/resumeSession.ts
|
|
61663
61719
|
function resumeSession(id, sessionId2, cwd, name2, holdPty, harness) {
|
|
@@ -61687,7 +61743,7 @@ function resumeSession(id, sessionId2, cwd, name2, holdPty, harness) {
|
|
|
61687
61743
|
}
|
|
61688
61744
|
|
|
61689
61745
|
// src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
|
|
61690
|
-
import { existsSync as
|
|
61746
|
+
import { existsSync as existsSync113 } from "fs";
|
|
61691
61747
|
function resumeInReplacementTree(ctx, conversationId, missingCwd, name2, harness) {
|
|
61692
61748
|
const adapter = harnessAdapter(harness);
|
|
61693
61749
|
const blocker = launchBlocker(adapter, conversationRecoveryFeature);
|
|
@@ -61722,7 +61778,7 @@ function resumeInReplacementTree(ctx, conversationId, missingCwd, name2, harness
|
|
|
61722
61778
|
}
|
|
61723
61779
|
function cloneForReapedTree(missingCwd) {
|
|
61724
61780
|
const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
|
|
61725
|
-
if (!clone || !
|
|
61781
|
+
if (!clone || !existsSync113(clone))
|
|
61726
61782
|
throw new Error(
|
|
61727
61783
|
`working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
|
|
61728
61784
|
);
|
|
@@ -61731,7 +61787,7 @@ function cloneForReapedTree(missingCwd) {
|
|
|
61731
61787
|
|
|
61732
61788
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
61733
61789
|
function resumeInTree(ctx, sessionId2, cwd, name2, harness) {
|
|
61734
|
-
if (!
|
|
61790
|
+
if (!existsSync114(cwd))
|
|
61735
61791
|
return resumeInReplacementTree(ctx, sessionId2, cwd, name2, harness);
|
|
61736
61792
|
const blocker = launchBlocker(
|
|
61737
61793
|
harnessAdapter(harness),
|
|
@@ -61938,13 +61994,13 @@ import {
|
|
|
61938
61994
|
} from "fs";
|
|
61939
61995
|
var MB = 1024 * 1024;
|
|
61940
61996
|
function trimDaemonLog({
|
|
61941
|
-
path:
|
|
61997
|
+
path: path128 = daemonPaths.log,
|
|
61942
61998
|
maxBytes = 50 * MB,
|
|
61943
61999
|
keepBytes = 25 * MB
|
|
61944
62000
|
} = {}) {
|
|
61945
62001
|
let fd;
|
|
61946
62002
|
try {
|
|
61947
|
-
fd = openSync8(
|
|
62003
|
+
fd = openSync8(path128, "r+");
|
|
61948
62004
|
} catch {
|
|
61949
62005
|
return void 0;
|
|
61950
62006
|
}
|
|
@@ -62110,7 +62166,7 @@ var handleWebLog = (client, _m, d) => {
|
|
|
62110
62166
|
};
|
|
62111
62167
|
|
|
62112
62168
|
// src/commands/sessions/daemon/historySearch/findTranscriptMatch.ts
|
|
62113
|
-
import * as
|
|
62169
|
+
import * as fs72 from "fs";
|
|
62114
62170
|
import * as readline5 from "readline";
|
|
62115
62171
|
|
|
62116
62172
|
// src/commands/sessions/daemon/historySearch/historySnippet.ts
|
|
@@ -62171,7 +62227,7 @@ function queryPattern(query) {
|
|
|
62171
62227
|
async function findTranscriptMatch(filePath, harness, query) {
|
|
62172
62228
|
const pattern2 = queryPattern(query);
|
|
62173
62229
|
const mayMatch = rawLinePrefilter(query);
|
|
62174
|
-
const stream =
|
|
62230
|
+
const stream = fs72.createReadStream(filePath, { encoding: "utf8" });
|
|
62175
62231
|
const reader = readline5.createInterface({
|
|
62176
62232
|
input: stream,
|
|
62177
62233
|
crlfDelay: Infinity
|
|
@@ -62276,7 +62332,7 @@ function creator(isNew, spawn14) {
|
|
|
62276
62332
|
}
|
|
62277
62333
|
|
|
62278
62334
|
// src/commands/sessions/shared/codex/codexRolloutUsage.ts
|
|
62279
|
-
import * as
|
|
62335
|
+
import * as fs73 from "fs";
|
|
62280
62336
|
|
|
62281
62337
|
// src/commands/sessions/shared/codex/applyTokenInfo.ts
|
|
62282
62338
|
function applyTokenInfo(usage, byId, conversationId, rawInfo) {
|
|
@@ -62339,7 +62395,7 @@ function codexRolloutUsage(lines) {
|
|
|
62339
62395
|
return usage;
|
|
62340
62396
|
}
|
|
62341
62397
|
async function readCodexRolloutUsage(rolloutPath) {
|
|
62342
|
-
const content = await
|
|
62398
|
+
const content = await fs73.promises.readFile(rolloutPath, "utf8");
|
|
62343
62399
|
return codexRolloutUsage(content.split("\n"));
|
|
62344
62400
|
}
|
|
62345
62401
|
function sessionMetaId(entry) {
|
|
@@ -62584,12 +62640,12 @@ var handleUserActivity = (client, m, d) => {
|
|
|
62584
62640
|
};
|
|
62585
62641
|
|
|
62586
62642
|
// src/commands/sessions/shared/parseTranscript.ts
|
|
62587
|
-
import * as
|
|
62643
|
+
import * as fs74 from "fs";
|
|
62588
62644
|
async function parseTranscript(conversationId) {
|
|
62589
62645
|
const located = await locateConversation(conversationId);
|
|
62590
62646
|
if (!located) return [];
|
|
62591
62647
|
try {
|
|
62592
|
-
const raw = await
|
|
62648
|
+
const raw = await fs74.promises.readFile(located.filePath, "utf8");
|
|
62593
62649
|
return transcriptMessages(located.reader, raw.split("\n"));
|
|
62594
62650
|
} catch {
|
|
62595
62651
|
return [];
|
|
@@ -62915,48 +62971,48 @@ async function confirmTransferredRun(sessions, id, trace) {
|
|
|
62915
62971
|
|
|
62916
62972
|
// src/commands/sessions/daemon/transfer/restoreTransferSnapshot.ts
|
|
62917
62973
|
var FETCH_TIMEOUT_MS2 = 12e4;
|
|
62918
|
-
async function switchToSnapshot(
|
|
62974
|
+
async function switchToSnapshot(path128, snapshot2, sha) {
|
|
62919
62975
|
const { branch: branch2 } = snapshot2;
|
|
62920
|
-
if (!branch2 || branch2 === await remoteDefaultBranch(
|
|
62921
|
-
await git2(
|
|
62922
|
-
return await gitOrNull(
|
|
62976
|
+
if (!branch2 || branch2 === await remoteDefaultBranch(path128)) {
|
|
62977
|
+
await git2(path128, ["reset", "--hard", "--quiet", sha]);
|
|
62978
|
+
return await gitOrNull(path128, ["symbolic-ref", "--short", "HEAD"]) ?? sha;
|
|
62923
62979
|
}
|
|
62924
|
-
await git2(
|
|
62980
|
+
await git2(path128, ["checkout", "--quiet", "-B", branch2, sha]);
|
|
62925
62981
|
return branch2;
|
|
62926
62982
|
}
|
|
62927
|
-
async function trackUpstream(
|
|
62928
|
-
await gitResult(
|
|
62929
|
-
const tracked = await gitResult(
|
|
62983
|
+
async function trackUpstream(path128, upstream) {
|
|
62984
|
+
await gitResult(path128, ["fetch", "--quiet", "origin", upstream]);
|
|
62985
|
+
const tracked = await gitResult(path128, [
|
|
62930
62986
|
"branch",
|
|
62931
62987
|
`--set-upstream-to=origin/${upstream}`
|
|
62932
62988
|
]);
|
|
62933
62989
|
if (!tracked.ok)
|
|
62934
62990
|
daemonLog(
|
|
62935
|
-
`transfer restore ${
|
|
62991
|
+
`transfer restore ${path128}: could not track origin/${upstream}: ${tracked.error}`
|
|
62936
62992
|
);
|
|
62937
62993
|
}
|
|
62938
|
-
async function restoreTransferSnapshot(
|
|
62939
|
-
if (await gitOrNull(
|
|
62940
|
-
throw new Error(`${
|
|
62994
|
+
async function restoreTransferSnapshot(path128, snapshot2) {
|
|
62995
|
+
if (await gitOrNull(path128, ["status", "--porcelain"]))
|
|
62996
|
+
throw new Error(`${path128} has uncommitted changes`);
|
|
62941
62997
|
await git2(
|
|
62942
|
-
|
|
62998
|
+
path128,
|
|
62943
62999
|
["fetch", "--quiet", "origin", `refs/heads/${snapshot2.ref}`],
|
|
62944
63000
|
FETCH_TIMEOUT_MS2
|
|
62945
63001
|
);
|
|
62946
|
-
const sha = (await git2(
|
|
62947
|
-
const branch2 = await switchToSnapshot(
|
|
62948
|
-
await git2(
|
|
62949
|
-
if (snapshot2.upstream) await trackUpstream(
|
|
63002
|
+
const sha = (await git2(path128, ["rev-parse", "FETCH_HEAD"])).trim();
|
|
63003
|
+
const branch2 = await switchToSnapshot(path128, snapshot2, sha);
|
|
63004
|
+
await git2(path128, ["reset", "--soft", "--quiet", "HEAD~1"]);
|
|
63005
|
+
if (snapshot2.upstream) await trackUpstream(path128, snapshot2.upstream);
|
|
62950
63006
|
daemonLog(
|
|
62951
|
-
`transfer restore ${
|
|
63007
|
+
`transfer restore ${path128}: ${snapshot2.ref} restored onto ${branch2}${snapshot2.upstream ? ` tracking origin/${snapshot2.upstream}` : ""}`
|
|
62952
63008
|
);
|
|
62953
63009
|
const deleted = await gitResult(
|
|
62954
|
-
|
|
63010
|
+
path128,
|
|
62955
63011
|
["push", "--no-verify", "--quiet", "origin", "--delete", snapshot2.ref],
|
|
62956
63012
|
FETCH_TIMEOUT_MS2
|
|
62957
63013
|
);
|
|
62958
63014
|
daemonLog(
|
|
62959
|
-
deleted.ok ? `transfer restore ${
|
|
63015
|
+
deleted.ok ? `transfer restore ${path128}: deleted ${snapshot2.ref} from origin` : `transfer restore ${path128}: could not delete ${snapshot2.ref} from origin: ${deleted.error}`
|
|
62960
63016
|
);
|
|
62961
63017
|
}
|
|
62962
63018
|
|
|
@@ -62967,10 +63023,10 @@ async function spawnTransferredRun(ctx, discard, { assistArgs, cwd, meta, snapsh
|
|
|
62967
63023
|
ctx,
|
|
62968
63024
|
cwd,
|
|
62969
63025
|
(sid, resolvedCwd) => createAssistSession(sid, assistArgs, resolvedCwd, meta, true),
|
|
62970
|
-
async (
|
|
62971
|
-
if (!
|
|
62972
|
-
daemonLog(`transfer restore ${
|
|
62973
|
-
await restoreTransferSnapshot(
|
|
63026
|
+
async (path128) => {
|
|
63027
|
+
if (!path128) throw new Error("no working tree to restore into");
|
|
63028
|
+
daemonLog(`transfer restore ${path128}: fetching ${snapshot2.ref} ${trace}`);
|
|
63029
|
+
await restoreTransferSnapshot(path128, snapshot2);
|
|
62974
63030
|
},
|
|
62975
63031
|
{ inPlace: meta.inPlace },
|
|
62976
63032
|
context
|
|
@@ -63009,7 +63065,7 @@ function isPrCheckoutArgs(args) {
|
|
|
63009
63065
|
|
|
63010
63066
|
// src/commands/sessions/daemon/worktree/prCheckoutHolder.ts
|
|
63011
63067
|
import { execFile as execFile15 } from "child_process";
|
|
63012
|
-
import { existsSync as
|
|
63068
|
+
import { existsSync as existsSync115 } from "fs";
|
|
63013
63069
|
function prHeadBranch2(number, cwd) {
|
|
63014
63070
|
const { headBranch } = prCliCommands(number, cwd);
|
|
63015
63071
|
return new Promise((resolve36) => {
|
|
@@ -63023,12 +63079,12 @@ function prHeadBranch2(number, cwd) {
|
|
|
63023
63079
|
}
|
|
63024
63080
|
async function prCheckoutHolder(assistArgs, cwd) {
|
|
63025
63081
|
const number = prCheckoutNumber(assistArgs);
|
|
63026
|
-
if (!number || !cwd || !
|
|
63082
|
+
if (!number || !cwd || !existsSync115(cwd)) return void 0;
|
|
63027
63083
|
const headRef = await prHeadBranch2(number, cwd);
|
|
63028
63084
|
if (!headRef) return void 0;
|
|
63029
63085
|
const listing = await gitOrNull(cwd, ["worktree", "list", "--porcelain"]);
|
|
63030
63086
|
const holder = listing ? worktreeWithBranch(listing, headRef) : null;
|
|
63031
|
-
if (!holder || !
|
|
63087
|
+
if (!holder || !existsSync115(holder)) return void 0;
|
|
63032
63088
|
daemonLog(
|
|
63033
63089
|
`pr #${number} assist ${assistArgs[0]} launched in its checkout ${holder}: head branch ${headRef} is already checked out there, so no worktree is allocated`
|
|
63034
63090
|
);
|
|
@@ -63696,8 +63752,8 @@ async function awaitLinkReturn(name2, options2, deps2 = {}) {
|
|
|
63696
63752
|
}
|
|
63697
63753
|
|
|
63698
63754
|
// src/commands/sessions/nodes/postToPeer.ts
|
|
63699
|
-
async function postToPeer(baseUrl2,
|
|
63700
|
-
const res = await fetch(new URL(
|
|
63755
|
+
async function postToPeer(baseUrl2, path128, traceId, timeoutMs) {
|
|
63756
|
+
const res = await fetch(new URL(path128, baseUrl2), {
|
|
63701
63757
|
method: "POST",
|
|
63702
63758
|
headers: {
|
|
63703
63759
|
"x-assist-linked-from": resolveNodeName(),
|
|
@@ -63707,7 +63763,7 @@ async function postToPeer(baseUrl2, path126, traceId, timeoutMs) {
|
|
|
63707
63763
|
});
|
|
63708
63764
|
if (res.ok) return;
|
|
63709
63765
|
const body = await res.json().catch(() => ({}));
|
|
63710
|
-
throw new Error(body.error ?? `POST ${
|
|
63766
|
+
throw new Error(body.error ?? `POST ${path128} returned ${res.status}`);
|
|
63711
63767
|
}
|
|
63712
63768
|
|
|
63713
63769
|
// src/commands/sessions/nodes/startPeerAction.ts
|