@staff0rd/assist 0.637.0 → 0.638.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/sessions/web/bundle.js +414 -414
- package/dist/index.js +606 -526
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.638.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -307,8 +307,8 @@ function getRemoteOriginUrl(cwd) {
|
|
|
307
307
|
}
|
|
308
308
|
|
|
309
309
|
// src/commands/backlog/getCurrentOrigin.ts
|
|
310
|
-
function stripLeadingSlashes(
|
|
311
|
-
return
|
|
310
|
+
function stripLeadingSlashes(path91) {
|
|
311
|
+
return path91.replace(/^\/+/, "");
|
|
312
312
|
}
|
|
313
313
|
function normalizeOrigin(raw) {
|
|
314
314
|
const trimmed = raw.trim().replace(/\.git$/i, "").replace(/\/+$/, "");
|
|
@@ -358,9 +358,9 @@ function findGitLink(dir) {
|
|
|
358
358
|
}
|
|
359
359
|
return null;
|
|
360
360
|
}
|
|
361
|
-
function isFile(
|
|
361
|
+
function isFile(path91) {
|
|
362
362
|
try {
|
|
363
|
-
return statSync(
|
|
363
|
+
return statSync(path91).isFile();
|
|
364
364
|
} catch {
|
|
365
365
|
return false;
|
|
366
366
|
}
|
|
@@ -379,9 +379,9 @@ function linkedGitDirParent(gitDir) {
|
|
|
379
379
|
const match = /^(.*)[/\\]worktrees[/\\][^/\\]+[/\\]?$/.exec(gitDir);
|
|
380
380
|
return match ? match[1] : null;
|
|
381
381
|
}
|
|
382
|
-
function readTrimmed(
|
|
382
|
+
function readTrimmed(path91) {
|
|
383
383
|
try {
|
|
384
|
-
const content = readFileSync2(
|
|
384
|
+
const content = readFileSync2(path91, "utf8").trim();
|
|
385
385
|
return content === "" ? null : content;
|
|
386
386
|
} catch {
|
|
387
387
|
return null;
|
|
@@ -394,10 +394,10 @@ function absolute(target, from) {
|
|
|
394
394
|
// src/shared/loadRawYaml.ts
|
|
395
395
|
import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
|
|
396
396
|
import { parse as parseYaml } from "yaml";
|
|
397
|
-
function loadRawYaml(
|
|
398
|
-
if (!existsSync3(
|
|
397
|
+
function loadRawYaml(path91) {
|
|
398
|
+
if (!existsSync3(path91)) return {};
|
|
399
399
|
try {
|
|
400
|
-
const content = readFileSync3(
|
|
400
|
+
const content = readFileSync3(path91, "utf8");
|
|
401
401
|
return parseYaml(content) || {};
|
|
402
402
|
} catch {
|
|
403
403
|
return {};
|
|
@@ -469,8 +469,8 @@ function mergeRawConfigs(globalRaw, projectRaw) {
|
|
|
469
469
|
// src/commands/backlog/originDisplayName.ts
|
|
470
470
|
function originDisplayName(origin) {
|
|
471
471
|
if (origin.startsWith("local:")) {
|
|
472
|
-
const
|
|
473
|
-
const segments =
|
|
472
|
+
const path91 = origin.slice("local:".length).replace(/\/+$/, "");
|
|
473
|
+
const segments = path91.split("/").filter(Boolean);
|
|
474
474
|
return segments[segments.length - 1] ?? origin;
|
|
475
475
|
}
|
|
476
476
|
const firstSlash = origin.indexOf("/");
|
|
@@ -2867,11 +2867,11 @@ function enumValues(node) {
|
|
|
2867
2867
|
function opaqueConfigNode(inner, base) {
|
|
2868
2868
|
return { ...base, kind: "other", type: leafTypeOf(inner) };
|
|
2869
2869
|
}
|
|
2870
|
-
function build(node,
|
|
2870
|
+
function build(node, path91) {
|
|
2871
2871
|
const { inner, defaultValue, optional } = unwrapSchemaNode(node);
|
|
2872
2872
|
const secret = isSecretSchemaNode(node) || isSecretSchemaNode(inner);
|
|
2873
2873
|
const base = {
|
|
2874
|
-
path:
|
|
2874
|
+
path: path91,
|
|
2875
2875
|
...optional ? { optional: true } : {},
|
|
2876
2876
|
...defaultValue === void 0 ? {} : { defaultValue },
|
|
2877
2877
|
...secret ? { secret: true } : {}
|
|
@@ -2890,9 +2890,9 @@ function segmentText(segment) {
|
|
|
2890
2890
|
if (segment.kind === "index") return `[${segment.index}]`;
|
|
2891
2891
|
return "[]";
|
|
2892
2892
|
}
|
|
2893
|
-
function formatConfigPath(
|
|
2893
|
+
function formatConfigPath(path91) {
|
|
2894
2894
|
let text18 = "";
|
|
2895
|
-
for (const segment of
|
|
2895
|
+
for (const segment of path91) {
|
|
2896
2896
|
const dotted = segment.kind === "key" || segment.kind === "entry";
|
|
2897
2897
|
const rendered = segmentText(segment);
|
|
2898
2898
|
text18 += dotted && text18 ? `.${rendered}` : rendered;
|
|
@@ -3590,9 +3590,9 @@ import { existsSync as existsSync13, readFileSync as readFileSync10 } from "fs";
|
|
|
3590
3590
|
|
|
3591
3591
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
3592
3592
|
import { minimatch as minimatch2 } from "minimatch";
|
|
3593
|
-
function resolveStringsAtPath(data,
|
|
3593
|
+
function resolveStringsAtPath(data, path91) {
|
|
3594
3594
|
let current = data;
|
|
3595
|
-
for (const segment of
|
|
3595
|
+
for (const segment of path91.split(".")) {
|
|
3596
3596
|
if (current === null || typeof current !== "object") return [];
|
|
3597
3597
|
current = current[segment];
|
|
3598
3598
|
}
|
|
@@ -3605,10 +3605,10 @@ function resolveStringsAtPath(data, path90) {
|
|
|
3605
3605
|
}
|
|
3606
3606
|
function findRuleViolations(data, rule) {
|
|
3607
3607
|
const violations = [];
|
|
3608
|
-
for (const
|
|
3609
|
-
for (const value of resolveStringsAtPath(data,
|
|
3608
|
+
for (const path91 of rule.paths) {
|
|
3609
|
+
for (const value of resolveStringsAtPath(data, path91)) {
|
|
3610
3610
|
if (minimatch2(value, rule.disallowed))
|
|
3611
|
-
violations.push({ file: rule.file, path:
|
|
3611
|
+
violations.push({ file: rule.file, path: path91, value });
|
|
3612
3612
|
}
|
|
3613
3613
|
}
|
|
3614
3614
|
return violations;
|
|
@@ -3647,8 +3647,8 @@ function forbiddenStrings() {
|
|
|
3647
3647
|
process.exit(0);
|
|
3648
3648
|
}
|
|
3649
3649
|
console.log("Forbidden strings found:\n");
|
|
3650
|
-
for (const { file, path:
|
|
3651
|
-
console.log(` ${file} ${
|
|
3650
|
+
for (const { file, path: path91, value } of violations) {
|
|
3651
|
+
console.log(` ${file} ${path91}: ${value}`);
|
|
3652
3652
|
}
|
|
3653
3653
|
console.log(`
|
|
3654
3654
|
Total: ${violations.length} forbidden string(s).`);
|
|
@@ -4251,15 +4251,15 @@ function readBaselineMigrations(repoRelativeDir, ref) {
|
|
|
4251
4251
|
} catch {
|
|
4252
4252
|
return baseline;
|
|
4253
4253
|
}
|
|
4254
|
-
const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((
|
|
4255
|
-
for (const
|
|
4254
|
+
const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path91) => MIGRATION_FILE3.test(basename2(path91)));
|
|
4255
|
+
for (const path91 of paths) {
|
|
4256
4256
|
try {
|
|
4257
|
-
const content = execSync6(`git show "${ref}:${
|
|
4257
|
+
const content = execSync6(`git show "${ref}:${path91}"`, {
|
|
4258
4258
|
encoding: "utf8",
|
|
4259
4259
|
maxBuffer: 16 * 1024 * 1024,
|
|
4260
4260
|
stdio: ["pipe", "pipe", "pipe"]
|
|
4261
4261
|
});
|
|
4262
|
-
baseline.set(basename2(
|
|
4262
|
+
baseline.set(basename2(path91), content);
|
|
4263
4263
|
} catch {
|
|
4264
4264
|
}
|
|
4265
4265
|
}
|
|
@@ -6307,10 +6307,10 @@ var hooksSettings = {
|
|
|
6307
6307
|
}
|
|
6308
6308
|
};
|
|
6309
6309
|
function ensureHooksSettings() {
|
|
6310
|
-
const
|
|
6311
|
-
mkdirSync5(dirname13(
|
|
6312
|
-
writeFileSync15(
|
|
6313
|
-
return
|
|
6310
|
+
const path91 = daemonPaths.hooksSettings;
|
|
6311
|
+
mkdirSync5(dirname13(path91), { recursive: true });
|
|
6312
|
+
writeFileSync15(path91, JSON.stringify(hooksSettings, null, 2));
|
|
6313
|
+
return path91;
|
|
6314
6314
|
}
|
|
6315
6315
|
|
|
6316
6316
|
// src/shared/spawnInherit.ts
|
|
@@ -6488,8 +6488,8 @@ function getPreferredRemoteRepo(cwd) {
|
|
|
6488
6488
|
function gitRefUrl(kind, ref, cwd) {
|
|
6489
6489
|
const repo = getPreferredRemoteRepo(cwd);
|
|
6490
6490
|
if (!repo) return void 0;
|
|
6491
|
-
const
|
|
6492
|
-
return `https://github.com/${repo.org}/${repo.repo}/${
|
|
6491
|
+
const path91 = kind === "branch" ? "tree" : "commit";
|
|
6492
|
+
return `https://github.com/${repo.org}/${repo.repo}/${path91}/${ref}`;
|
|
6493
6493
|
}
|
|
6494
6494
|
|
|
6495
6495
|
// src/commands/branch/buildBranchName.ts
|
|
@@ -6732,9 +6732,9 @@ var LOCAL_FILES = ["backlog.jsonl", "backlog.db"];
|
|
|
6732
6732
|
function backupLocalBacklogFiles(dir) {
|
|
6733
6733
|
const moved = [];
|
|
6734
6734
|
for (const name of LOCAL_FILES) {
|
|
6735
|
-
const
|
|
6736
|
-
if (existsSync19(
|
|
6737
|
-
renameSync(
|
|
6735
|
+
const path91 = join15(dir, ".assist", name);
|
|
6736
|
+
if (existsSync19(path91)) {
|
|
6737
|
+
renameSync(path91, `${path91}.bak`);
|
|
6738
6738
|
moved.push(`${name} \u2192 ${name}.bak`);
|
|
6739
6739
|
}
|
|
6740
6740
|
}
|
|
@@ -6972,12 +6972,15 @@ function attachGitRefs(item, rel, id) {
|
|
|
6972
6972
|
|
|
6973
6973
|
// src/commands/backlog/attachSessions.ts
|
|
6974
6974
|
function rowToSession(s) {
|
|
6975
|
-
|
|
6975
|
+
const session = {
|
|
6976
6976
|
phaseIdx: s.phaseIdx,
|
|
6977
6977
|
claudeSessionId: s.claudeSessionId,
|
|
6978
6978
|
hostname: s.hostname,
|
|
6979
6979
|
osUser: s.osUser
|
|
6980
6980
|
};
|
|
6981
|
+
if (s.createdAt != null)
|
|
6982
|
+
session.createdAt = new Date(s.createdAt).toISOString();
|
|
6983
|
+
return session;
|
|
6981
6984
|
}
|
|
6982
6985
|
function attachSessions(item, rel, id) {
|
|
6983
6986
|
const sessions = (rel.sessions.get(id) ?? []).map(rowToSession);
|
|
@@ -7147,7 +7150,8 @@ var phaseSessionSchema = z4.strictObject({
|
|
|
7147
7150
|
phaseIdx: z4.number(),
|
|
7148
7151
|
claudeSessionId: z4.string(),
|
|
7149
7152
|
hostname: z4.string(),
|
|
7150
|
-
osUser: z4.string()
|
|
7153
|
+
osUser: z4.string(),
|
|
7154
|
+
createdAt: z4.string().optional()
|
|
7151
7155
|
});
|
|
7152
7156
|
var phaseUsageTotalSchema = z4.strictObject({
|
|
7153
7157
|
tokensUp: z4.number(),
|
|
@@ -7214,8 +7218,8 @@ var backlogItemSchema = z4.strictObject({
|
|
|
7214
7218
|
var backlogFileSchema = z4.array(backlogItemSchema);
|
|
7215
7219
|
|
|
7216
7220
|
// src/commands/backlog/parseBacklogJsonl.ts
|
|
7217
|
-
function parseBacklogJsonl(
|
|
7218
|
-
const content = readFileSync15(
|
|
7221
|
+
function parseBacklogJsonl(path91) {
|
|
7222
|
+
const content = readFileSync15(path91, "utf8").trim();
|
|
7219
7223
|
if (content.length === 0) return [];
|
|
7220
7224
|
return content.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => backlogItemSchema.parse(JSON.parse(line)));
|
|
7221
7225
|
}
|
|
@@ -8026,24 +8030,24 @@ function getOwnerPath(itemId2) {
|
|
|
8026
8030
|
function recordSignalOwner(itemId2) {
|
|
8027
8031
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
8028
8032
|
if (!sessionId) return;
|
|
8029
|
-
const
|
|
8030
|
-
mkdirSync7(dirname15(
|
|
8031
|
-
writeFileSync17(
|
|
8033
|
+
const path91 = getOwnerPath(itemId2);
|
|
8034
|
+
mkdirSync7(dirname15(path91), { recursive: true });
|
|
8035
|
+
writeFileSync17(path91, JSON.stringify({ sessionId }));
|
|
8032
8036
|
}
|
|
8033
8037
|
function readSignalOwner(itemId2) {
|
|
8034
|
-
const
|
|
8035
|
-
if (!existsSync23(
|
|
8038
|
+
const path91 = getOwnerPath(itemId2);
|
|
8039
|
+
if (!existsSync23(path91)) return void 0;
|
|
8036
8040
|
try {
|
|
8037
|
-
const parsed = JSON.parse(readFileSync16(
|
|
8041
|
+
const parsed = JSON.parse(readFileSync16(path91, "utf8"));
|
|
8038
8042
|
return parsed.sessionId;
|
|
8039
8043
|
} catch {
|
|
8040
8044
|
return void 0;
|
|
8041
8045
|
}
|
|
8042
8046
|
}
|
|
8043
8047
|
function clearSignalOwner(itemId2) {
|
|
8044
|
-
const
|
|
8048
|
+
const path91 = getOwnerPath(itemId2);
|
|
8045
8049
|
try {
|
|
8046
|
-
rmSync(
|
|
8050
|
+
rmSync(path91);
|
|
8047
8051
|
} catch {
|
|
8048
8052
|
}
|
|
8049
8053
|
}
|
|
@@ -8080,19 +8084,19 @@ function resolveSignalTarget(event, data) {
|
|
|
8080
8084
|
function writeSignal(event, data) {
|
|
8081
8085
|
const target = resolveSignalTarget(event, data);
|
|
8082
8086
|
if (!target) return;
|
|
8083
|
-
const
|
|
8084
|
-
if (!
|
|
8087
|
+
const path91 = getSignalPath(target);
|
|
8088
|
+
if (!path91) return;
|
|
8085
8089
|
const signal = { event, sessionId: target, ...data };
|
|
8086
|
-
mkdirSync8(dirname16(
|
|
8087
|
-
writeFileSync18(
|
|
8090
|
+
mkdirSync8(dirname16(path91), { recursive: true });
|
|
8091
|
+
writeFileSync18(path91, JSON.stringify(signal));
|
|
8088
8092
|
}
|
|
8089
8093
|
|
|
8090
8094
|
// src/commands/backlog/readSignal.ts
|
|
8091
8095
|
function readSignal() {
|
|
8092
|
-
const
|
|
8093
|
-
if (!
|
|
8096
|
+
const path91 = getSignalPath();
|
|
8097
|
+
if (!path91 || !existsSync24(path91)) return void 0;
|
|
8094
8098
|
try {
|
|
8095
|
-
return JSON.parse(readFileSync17(
|
|
8099
|
+
return JSON.parse(readFileSync17(path91, "utf8"));
|
|
8096
8100
|
} catch {
|
|
8097
8101
|
return void 0;
|
|
8098
8102
|
}
|
|
@@ -8290,13 +8294,13 @@ function activityPath(sessionId) {
|
|
|
8290
8294
|
function emitActivity(activity2) {
|
|
8291
8295
|
const sessionId = process.env.ASSIST_ACTIVITY_ID;
|
|
8292
8296
|
if (!sessionId) return;
|
|
8293
|
-
const
|
|
8294
|
-
mkdirSync9(dirname17(
|
|
8295
|
-
writeFileSync19(
|
|
8297
|
+
const path91 = activityPath(sessionId);
|
|
8298
|
+
mkdirSync9(dirname17(path91), { recursive: true });
|
|
8299
|
+
writeFileSync19(path91, JSON.stringify({ ...activity2, startedAt: Date.now() }));
|
|
8296
8300
|
}
|
|
8297
|
-
function readActivity(
|
|
8301
|
+
function readActivity(path91) {
|
|
8298
8302
|
try {
|
|
8299
|
-
return JSON.parse(readFileSync18(
|
|
8303
|
+
return JSON.parse(readFileSync18(path91, "utf8"));
|
|
8300
8304
|
} catch {
|
|
8301
8305
|
return void 0;
|
|
8302
8306
|
}
|
|
@@ -8306,9 +8310,9 @@ function reconcileActivity(sessionId, activity2) {
|
|
|
8306
8310
|
removeActivity(sessionId);
|
|
8307
8311
|
return;
|
|
8308
8312
|
}
|
|
8309
|
-
const
|
|
8310
|
-
mkdirSync9(dirname17(
|
|
8311
|
-
writeFileSync19(
|
|
8313
|
+
const path91 = activityPath(sessionId);
|
|
8314
|
+
mkdirSync9(dirname17(path91), { recursive: true });
|
|
8315
|
+
writeFileSync19(path91, JSON.stringify(activity2));
|
|
8312
8316
|
}
|
|
8313
8317
|
function removeActivity(sessionId) {
|
|
8314
8318
|
try {
|
|
@@ -9160,15 +9164,15 @@ import chalk52 from "chalk";
|
|
|
9160
9164
|
// src/commands/backlog/groupActivityRefs.ts
|
|
9161
9165
|
var ACTIVITY_COMMIT_LIMIT = 10;
|
|
9162
9166
|
function groupActivityRefs(refs, commitLimit = ACTIVITY_COMMIT_LIMIT) {
|
|
9163
|
-
const
|
|
9164
|
-
const commits2 =
|
|
9167
|
+
const newestFirst2 = (kind) => refs.filter((r) => r.kind === kind).reverse();
|
|
9168
|
+
const commits2 = newestFirst2("commit");
|
|
9165
9169
|
return {
|
|
9166
|
-
branches:
|
|
9170
|
+
branches: newestFirst2("branch"),
|
|
9167
9171
|
commits: commits2.slice(0, commitLimit),
|
|
9168
9172
|
overflowCommits: commits2.slice(commitLimit),
|
|
9169
|
-
prs:
|
|
9170
|
-
slacks:
|
|
9171
|
-
sessions:
|
|
9173
|
+
prs: newestFirst2("pr"),
|
|
9174
|
+
slacks: newestFirst2("slack"),
|
|
9175
|
+
sessions: newestFirst2("session")
|
|
9172
9176
|
};
|
|
9173
9177
|
}
|
|
9174
9178
|
|
|
@@ -9761,10 +9765,10 @@ function getStorePath(filename) {
|
|
|
9761
9765
|
return join26(getStoreDir(), filename);
|
|
9762
9766
|
}
|
|
9763
9767
|
function loadJson(filename) {
|
|
9764
|
-
const
|
|
9765
|
-
if (existsSync29(
|
|
9768
|
+
const path91 = getStorePath(filename);
|
|
9769
|
+
if (existsSync29(path91)) {
|
|
9766
9770
|
try {
|
|
9767
|
-
return JSON.parse(readFileSync19(
|
|
9771
|
+
return JSON.parse(readFileSync19(path91, "utf8"));
|
|
9768
9772
|
} catch {
|
|
9769
9773
|
return {};
|
|
9770
9774
|
}
|
|
@@ -9783,22 +9787,22 @@ function saveJson(filename, data) {
|
|
|
9783
9787
|
var REGISTRY_FILE = "worktrees.json";
|
|
9784
9788
|
function readWorktreeRegistry() {
|
|
9785
9789
|
const data = loadJson(REGISTRY_FILE);
|
|
9786
|
-
return Object.entries(data).filter(([, record]) => !record.reaped).map(([
|
|
9790
|
+
return Object.entries(data).filter(([, record]) => !record.reaped).map(([path91, record]) => ({ path: path91, ...record }));
|
|
9787
9791
|
}
|
|
9788
|
-
function worktreeAttributionIncludingReaped(
|
|
9789
|
-
const record = loadJson(REGISTRY_FILE)[
|
|
9792
|
+
function worktreeAttributionIncludingReaped(path91) {
|
|
9793
|
+
const record = loadJson(REGISTRY_FILE)[path91];
|
|
9790
9794
|
return record ? { clone: record.clone, origin: record.origin } : void 0;
|
|
9791
9795
|
}
|
|
9792
|
-
function recordWorktree(
|
|
9796
|
+
function recordWorktree(path91, clone, origin) {
|
|
9793
9797
|
const data = loadJson(REGISTRY_FILE);
|
|
9794
|
-
data[
|
|
9798
|
+
data[path91] = { clone, origin };
|
|
9795
9799
|
saveJson(REGISTRY_FILE, data);
|
|
9796
9800
|
}
|
|
9797
|
-
function forgetWorktree(
|
|
9801
|
+
function forgetWorktree(path91) {
|
|
9798
9802
|
const data = loadJson(REGISTRY_FILE);
|
|
9799
|
-
const record = data[
|
|
9803
|
+
const record = data[path91];
|
|
9800
9804
|
if (!record || record.reaped) return;
|
|
9801
|
-
data[
|
|
9805
|
+
data[path91] = { ...record, reaped: true };
|
|
9802
9806
|
saveJson(REGISTRY_FILE, data);
|
|
9803
9807
|
}
|
|
9804
9808
|
|
|
@@ -10064,6 +10068,78 @@ async function updateStarred(orm, id, starred) {
|
|
|
10064
10068
|
return row?.name;
|
|
10065
10069
|
}
|
|
10066
10070
|
|
|
10071
|
+
// src/commands/sessions/shared/lookupSessionsById.ts
|
|
10072
|
+
import * as path30 from "path";
|
|
10073
|
+
var CODEX_ROLLOUT_ID_LENGTH = 36;
|
|
10074
|
+
async function lookupSessionsById(ids) {
|
|
10075
|
+
const wanted = new Set(ids);
|
|
10076
|
+
if (wanted.size === 0) return /* @__PURE__ */ new Map();
|
|
10077
|
+
const found = /* @__PURE__ */ new Map();
|
|
10078
|
+
const [claudePaths, codexPaths] = await Promise.all([
|
|
10079
|
+
discoverSessionJsonlPaths(),
|
|
10080
|
+
discoverCodexRolloutPaths()
|
|
10081
|
+
]);
|
|
10082
|
+
await Promise.all([
|
|
10083
|
+
...claudePaths.map(async ({ path: filePath, origin }) => {
|
|
10084
|
+
const id = path30.basename(filePath, ".jsonl");
|
|
10085
|
+
if (!wanted.has(id)) return;
|
|
10086
|
+
const session = await parseSessionFile(filePath, origin);
|
|
10087
|
+
if (session) found.set(id, session);
|
|
10088
|
+
}),
|
|
10089
|
+
...codexPaths.map(async (filePath) => {
|
|
10090
|
+
const id = codexRolloutIdFromFilename(filePath);
|
|
10091
|
+
if (!id || !wanted.has(id)) return;
|
|
10092
|
+
const session = await parseCodexSessionFile(filePath);
|
|
10093
|
+
if (session) found.set(id, session);
|
|
10094
|
+
})
|
|
10095
|
+
]);
|
|
10096
|
+
return found;
|
|
10097
|
+
}
|
|
10098
|
+
function codexRolloutIdFromFilename(filePath) {
|
|
10099
|
+
const name = path30.basename(filePath, ".jsonl");
|
|
10100
|
+
return name.length > CODEX_ROLLOUT_ID_LENGTH ? name.slice(-CODEX_ROLLOUT_ID_LENGTH) : void 0;
|
|
10101
|
+
}
|
|
10102
|
+
|
|
10103
|
+
// src/commands/backlog/web/itemConversations.ts
|
|
10104
|
+
async function itemConversations(item) {
|
|
10105
|
+
const byId = /* @__PURE__ */ new Map();
|
|
10106
|
+
for (const ref of item.gitRefs ?? []) {
|
|
10107
|
+
if (ref.kind !== "session" || byId.has(ref.ref)) continue;
|
|
10108
|
+
byId.set(ref.ref, {
|
|
10109
|
+
sessionId: ref.ref,
|
|
10110
|
+
...ref.title && { title: ref.title },
|
|
10111
|
+
...ref.createdAt && { createdAt: ref.createdAt }
|
|
10112
|
+
});
|
|
10113
|
+
}
|
|
10114
|
+
for (const session of item.phaseSessions ?? []) {
|
|
10115
|
+
const { claudeSessionId: sessionId, createdAt } = session;
|
|
10116
|
+
if (byId.has(sessionId)) continue;
|
|
10117
|
+
byId.set(sessionId, { sessionId, ...createdAt && { createdAt } });
|
|
10118
|
+
}
|
|
10119
|
+
if (byId.size === 0) return [];
|
|
10120
|
+
const transcripts = await lookupSessionsById([...byId.keys()]);
|
|
10121
|
+
return [...byId.values()].map(
|
|
10122
|
+
(conversation) => withTranscript(conversation, transcripts.get(conversation.sessionId))
|
|
10123
|
+
).sort(newestFirst);
|
|
10124
|
+
}
|
|
10125
|
+
function withTranscript(conversation, transcript) {
|
|
10126
|
+
if (!transcript) return conversation;
|
|
10127
|
+
return {
|
|
10128
|
+
...conversation,
|
|
10129
|
+
...transcript.cwd && { cwd: transcript.cwd },
|
|
10130
|
+
...transcript.harness && { harness: transcript.harness },
|
|
10131
|
+
title: conversation.title ?? transcript.name,
|
|
10132
|
+
createdAt: conversation.createdAt ?? transcript.timestamp
|
|
10133
|
+
};
|
|
10134
|
+
}
|
|
10135
|
+
function sortKey(conversation) {
|
|
10136
|
+
const parsed = Date.parse(conversation.createdAt ?? "");
|
|
10137
|
+
return Number.isNaN(parsed) ? 0 : parsed;
|
|
10138
|
+
}
|
|
10139
|
+
function newestFirst(a, b) {
|
|
10140
|
+
return sortKey(b) - sortKey(a);
|
|
10141
|
+
}
|
|
10142
|
+
|
|
10067
10143
|
// src/commands/backlog/loadBacklogSummaries.ts
|
|
10068
10144
|
async function loadBacklogSummaries(allRepos = false) {
|
|
10069
10145
|
const { orm } = await getReady();
|
|
@@ -10148,7 +10224,11 @@ async function findItemOr404(res, id) {
|
|
|
10148
10224
|
}
|
|
10149
10225
|
async function getItemById(res, id) {
|
|
10150
10226
|
const result = await findItemOr404(res, id);
|
|
10151
|
-
if (result)
|
|
10227
|
+
if (!result) return;
|
|
10228
|
+
const item = withReviewPhase(result.item);
|
|
10229
|
+
const conversations = await itemConversations(item);
|
|
10230
|
+
if (conversations.length > 0) item.conversations = conversations;
|
|
10231
|
+
respondJson(res, 200, item);
|
|
10152
10232
|
}
|
|
10153
10233
|
async function deleteItem2(res, id) {
|
|
10154
10234
|
const result = await findItemOr404(res, id);
|
|
@@ -10550,8 +10630,8 @@ async function loadCommittedPaths(cwd, sessionId) {
|
|
|
10550
10630
|
for (const commit2 of commits2) {
|
|
10551
10631
|
const resolved = await resolveCommit(cwd, commit2.sha);
|
|
10552
10632
|
if (!resolved) continue;
|
|
10553
|
-
for (const
|
|
10554
|
-
if (!bases.has(
|
|
10633
|
+
for (const path91 of resolved.paths) {
|
|
10634
|
+
if (!bases.has(path91)) bases.set(path91, resolved.base);
|
|
10555
10635
|
}
|
|
10556
10636
|
}
|
|
10557
10637
|
return { commits: commits2, bases };
|
|
@@ -10569,16 +10649,16 @@ async function itemChangeSet(cwd, sessionId) {
|
|
|
10569
10649
|
}
|
|
10570
10650
|
function groupByBase(bases) {
|
|
10571
10651
|
const groups = /* @__PURE__ */ new Map();
|
|
10572
|
-
for (const [
|
|
10652
|
+
for (const [path91, base] of bases) {
|
|
10573
10653
|
const paths = groups.get(base);
|
|
10574
|
-
if (paths) paths.push(
|
|
10575
|
-
else groups.set(base, [
|
|
10654
|
+
if (paths) paths.push(path91);
|
|
10655
|
+
else groups.set(base, [path91]);
|
|
10576
10656
|
}
|
|
10577
10657
|
return [...groups].map(([base, paths]) => ({ base, paths: paths.sort() }));
|
|
10578
10658
|
}
|
|
10579
10659
|
async function dirtyPaths(cwd, bases) {
|
|
10580
10660
|
const output = await execGit(cwd, ["diff", "--name-only", "HEAD"]);
|
|
10581
|
-
return output.split("\n").filter((
|
|
10661
|
+
return output.split("\n").filter((path91) => path91 && !bases.has(path91)).sort();
|
|
10582
10662
|
}
|
|
10583
10663
|
|
|
10584
10664
|
// src/commands/sessions/web/scopedDiff.ts
|
|
@@ -10587,8 +10667,8 @@ async function scopedDiff(cwd, session, scope) {
|
|
|
10587
10667
|
if (scope.kind === "commit") return commitDiff(cwd, scope.sha);
|
|
10588
10668
|
return await trackedScopeDiff(cwd, session, scope) + await untrackedDiff(cwd);
|
|
10589
10669
|
}
|
|
10590
|
-
async function untrackedFileDiff(cwd,
|
|
10591
|
-
return execGit(cwd, ["diff", "--no-index", "--", "/dev/null",
|
|
10670
|
+
async function untrackedFileDiff(cwd, path91) {
|
|
10671
|
+
return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path91], {
|
|
10592
10672
|
maxBuffer: MAX_DIFF_BYTES,
|
|
10593
10673
|
allowFailure: true
|
|
10594
10674
|
});
|
|
@@ -10601,7 +10681,7 @@ async function untrackedDiff(cwd) {
|
|
|
10601
10681
|
]);
|
|
10602
10682
|
const paths = list5.split("\n").filter(Boolean);
|
|
10603
10683
|
const diffs = await Promise.all(
|
|
10604
|
-
paths.map((
|
|
10684
|
+
paths.map((path91) => untrackedFileDiff(cwd, path91))
|
|
10605
10685
|
);
|
|
10606
10686
|
return diffs.join("");
|
|
10607
10687
|
}
|
|
@@ -10694,9 +10774,9 @@ import { isAbsolute as isAbsolute2, relative as relative2, resolve as resolve10
|
|
|
10694
10774
|
function repoRoot(cwd) {
|
|
10695
10775
|
return resolve10(toGitCwd(cwd));
|
|
10696
10776
|
}
|
|
10697
|
-
function resolveWithinCwd(cwd,
|
|
10777
|
+
function resolveWithinCwd(cwd, path91) {
|
|
10698
10778
|
const root = repoRoot(cwd);
|
|
10699
|
-
const target = resolve10(root,
|
|
10779
|
+
const target = resolve10(root, path91);
|
|
10700
10780
|
const rel = relative2(root, target);
|
|
10701
10781
|
if (rel === "" || rel.startsWith("..") || isAbsolute2(rel)) return null;
|
|
10702
10782
|
return target;
|
|
@@ -10706,14 +10786,14 @@ function resolveWithinCwd(cwd, path90) {
|
|
|
10706
10786
|
function getFileTarget(req, res) {
|
|
10707
10787
|
const cwd = getCwdParam(req, res);
|
|
10708
10788
|
if (!cwd) return null;
|
|
10709
|
-
const
|
|
10789
|
+
const path91 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
|
|
10710
10790
|
"path"
|
|
10711
10791
|
);
|
|
10712
|
-
if (!
|
|
10792
|
+
if (!path91) {
|
|
10713
10793
|
respondJson(res, 400, { error: "Missing path" });
|
|
10714
10794
|
return null;
|
|
10715
10795
|
}
|
|
10716
|
-
const target = resolveWithinCwd(cwd,
|
|
10796
|
+
const target = resolveWithinCwd(cwd, path91);
|
|
10717
10797
|
if (!target) {
|
|
10718
10798
|
respondJson(res, 400, { error: "Path outside cwd" });
|
|
10719
10799
|
return null;
|
|
@@ -10788,11 +10868,11 @@ function globalConfigTargetFor(cwd) {
|
|
|
10788
10868
|
|
|
10789
10869
|
// src/commands/config/globalConfigFileLabel.ts
|
|
10790
10870
|
var WINDOWS_MOUNT_PREFIX = "/mnt/";
|
|
10791
|
-
function globalConfigFileLabel(
|
|
10792
|
-
if (
|
|
10793
|
-
if (
|
|
10794
|
-
return `${
|
|
10795
|
-
return
|
|
10871
|
+
function globalConfigFileLabel(path91) {
|
|
10872
|
+
if (path91 === getGlobalConfigPath()) return "~/.assist.yml";
|
|
10873
|
+
if (path91.startsWith(WINDOWS_MOUNT_PREFIX))
|
|
10874
|
+
return `${path91} on the Windows host`;
|
|
10875
|
+
return path91;
|
|
10796
10876
|
}
|
|
10797
10877
|
|
|
10798
10878
|
// src/commands/config/readRawConfigLayers.ts
|
|
@@ -10849,35 +10929,35 @@ function isPlainRecord(value) {
|
|
|
10849
10929
|
}
|
|
10850
10930
|
|
|
10851
10931
|
// src/shared/mapConfigSecrets.ts
|
|
10852
|
-
function mapChildren(value,
|
|
10932
|
+
function mapChildren(value, path91, childNode, map) {
|
|
10853
10933
|
if (!isPlainRecord(value)) return value;
|
|
10854
10934
|
return Object.fromEntries(
|
|
10855
10935
|
Object.entries(value).map(([name, child]) => [
|
|
10856
10936
|
name,
|
|
10857
|
-
walk(child, [...
|
|
10937
|
+
walk(child, [...path91, name], childNode(name), map)
|
|
10858
10938
|
])
|
|
10859
10939
|
);
|
|
10860
10940
|
}
|
|
10861
|
-
function mapItems(value,
|
|
10941
|
+
function mapItems(value, path91, item, map) {
|
|
10862
10942
|
if (!Array.isArray(value)) return value;
|
|
10863
|
-
return value.map((entry, index3) => walk(entry, [...
|
|
10943
|
+
return value.map((entry, index3) => walk(entry, [...path91, index3], item, map));
|
|
10864
10944
|
}
|
|
10865
|
-
function walk(value,
|
|
10945
|
+
function walk(value, path91, node, map) {
|
|
10866
10946
|
if (!node || value === void 0 || value === null) return value;
|
|
10867
|
-
if (node.secret) return map(value,
|
|
10947
|
+
if (node.secret) return map(value, path91);
|
|
10868
10948
|
switch (node.kind) {
|
|
10869
10949
|
case "object":
|
|
10870
10950
|
case "unionOfObjects":
|
|
10871
10951
|
return mapChildren(
|
|
10872
10952
|
value,
|
|
10873
|
-
|
|
10953
|
+
path91,
|
|
10874
10954
|
(name) => configNodeField(node, name),
|
|
10875
10955
|
map
|
|
10876
10956
|
);
|
|
10877
10957
|
case "objectList":
|
|
10878
|
-
return mapItems(value,
|
|
10958
|
+
return mapItems(value, path91, node.item, map);
|
|
10879
10959
|
case "record":
|
|
10880
|
-
return mapChildren(value,
|
|
10960
|
+
return mapChildren(value, path91, () => node.value, map);
|
|
10881
10961
|
default:
|
|
10882
10962
|
return value;
|
|
10883
10963
|
}
|
|
@@ -10902,9 +10982,9 @@ function isTraversable(value) {
|
|
|
10902
10982
|
function stepInto(current, key) {
|
|
10903
10983
|
return isTraversable(current) ? current[key] : void 0;
|
|
10904
10984
|
}
|
|
10905
|
-
function getNestedValue(obj,
|
|
10985
|
+
function getNestedValue(obj, path91) {
|
|
10906
10986
|
let current = obj;
|
|
10907
|
-
for (const key of
|
|
10987
|
+
for (const key of path91.split(".")) current = stepInto(current, key);
|
|
10908
10988
|
return current;
|
|
10909
10989
|
}
|
|
10910
10990
|
|
|
@@ -10954,9 +11034,9 @@ function step(node, segment) {
|
|
|
10954
11034
|
return void 0;
|
|
10955
11035
|
}
|
|
10956
11036
|
}
|
|
10957
|
-
function findConfigNode(root,
|
|
11037
|
+
function findConfigNode(root, path91) {
|
|
10958
11038
|
let current = root;
|
|
10959
|
-
for (const segment of
|
|
11039
|
+
for (const segment of path91) {
|
|
10960
11040
|
if (!current) return void 0;
|
|
10961
11041
|
current = step(current, segment);
|
|
10962
11042
|
}
|
|
@@ -10973,34 +11053,34 @@ function nameSegment(name) {
|
|
|
10973
11053
|
return name === RECORD_ENTRY_TOKEN ? { kind: "entry" } : { kind: "key", name };
|
|
10974
11054
|
}
|
|
10975
11055
|
function parseConfigPath(text18) {
|
|
10976
|
-
const
|
|
11056
|
+
const path91 = [];
|
|
10977
11057
|
let at2 = 0;
|
|
10978
11058
|
while (at2 < text18.length) {
|
|
10979
11059
|
if (text18[at2] === "[") {
|
|
10980
11060
|
const close = text18.indexOf("]", at2);
|
|
10981
11061
|
const segment = close === -1 ? void 0 : bracketSegment(text18.slice(at2 + 1, close));
|
|
10982
11062
|
if (!segment) return void 0;
|
|
10983
|
-
|
|
11063
|
+
path91.push(segment);
|
|
10984
11064
|
at2 = close + 1;
|
|
10985
11065
|
continue;
|
|
10986
11066
|
}
|
|
10987
11067
|
if (text18[at2] === ".") {
|
|
10988
|
-
if (
|
|
11068
|
+
if (path91.length === 0) return void 0;
|
|
10989
11069
|
at2 += 1;
|
|
10990
11070
|
}
|
|
10991
11071
|
const start3 = at2;
|
|
10992
11072
|
while (at2 < text18.length && text18[at2] !== "." && text18[at2] !== "[") at2 += 1;
|
|
10993
11073
|
const name = text18.slice(start3, at2);
|
|
10994
11074
|
if (!name) return void 0;
|
|
10995
|
-
|
|
11075
|
+
path91.push(nameSegment(name));
|
|
10996
11076
|
}
|
|
10997
|
-
return
|
|
11077
|
+
return path91;
|
|
10998
11078
|
}
|
|
10999
11079
|
|
|
11000
11080
|
// src/commands/config/configEntryNode.ts
|
|
11001
11081
|
function configEntryNode(root, key) {
|
|
11002
|
-
const
|
|
11003
|
-
return
|
|
11082
|
+
const path91 = parseConfigPath(key);
|
|
11083
|
+
return path91 ? findConfigNode(root, path91) : void 0;
|
|
11004
11084
|
}
|
|
11005
11085
|
|
|
11006
11086
|
// src/commands/config/configHelpForKey.ts
|
|
@@ -11124,18 +11204,18 @@ function handleServerRuns(req, res) {
|
|
|
11124
11204
|
import { execFile as execFile4 } from "child_process";
|
|
11125
11205
|
import { readFileSync as readFileSync21 } from "fs";
|
|
11126
11206
|
import { homedir as homedir13 } from "os";
|
|
11127
|
-
import { basename as
|
|
11207
|
+
import { basename as basename10, join as join30 } from "path";
|
|
11128
11208
|
import { promisify as promisify3 } from "util";
|
|
11129
11209
|
|
|
11130
11210
|
// src/commands/sessions/web/findSynthesisForBranch.ts
|
|
11131
11211
|
import { existsSync as existsSync32, readdirSync as readdirSync2, statSync as statSync4 } from "fs";
|
|
11132
|
-
import { basename as
|
|
11212
|
+
import { basename as basename9, dirname as dirname21, join as join29 } from "path";
|
|
11133
11213
|
function findSynthesisForBranch(repoReviewsDir, branch2) {
|
|
11134
11214
|
const branchKeyPath = join29(repoReviewsDir, `${branch2}-`);
|
|
11135
11215
|
const parent = dirname21(branchKeyPath);
|
|
11136
|
-
const branchPrefix =
|
|
11216
|
+
const branchPrefix = basename9(branchKeyPath);
|
|
11137
11217
|
if (!existsSync32(parent)) return null;
|
|
11138
|
-
const synthesisFiles = readdirSync2(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join29(parent, name, "synthesis.md")).filter((
|
|
11218
|
+
const synthesisFiles = readdirSync2(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join29(parent, name, "synthesis.md")).filter((path91) => existsSync32(path91)).map((path91) => ({ path: path91, mtime: statSync4(path91).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
|
|
11139
11219
|
return synthesisFiles[0]?.path ?? null;
|
|
11140
11220
|
}
|
|
11141
11221
|
|
|
@@ -11157,7 +11237,7 @@ async function resolveSynthesisPath(cwd) {
|
|
|
11157
11237
|
homedir13(),
|
|
11158
11238
|
".assist",
|
|
11159
11239
|
"reviews",
|
|
11160
|
-
|
|
11240
|
+
basename10(repoRoot2)
|
|
11161
11241
|
);
|
|
11162
11242
|
return findSynthesisForBranch(repoReviewsDir, branch2);
|
|
11163
11243
|
}
|
|
@@ -11165,12 +11245,12 @@ async function getReviewSynthesis(req, res) {
|
|
|
11165
11245
|
const cwd = getCwdParam(req, res);
|
|
11166
11246
|
if (!cwd) return;
|
|
11167
11247
|
try {
|
|
11168
|
-
const
|
|
11169
|
-
if (!
|
|
11248
|
+
const path91 = await resolveSynthesisPath(cwd);
|
|
11249
|
+
if (!path91) {
|
|
11170
11250
|
respondJson(res, 404, { error: "No synthesis found" });
|
|
11171
11251
|
return;
|
|
11172
11252
|
}
|
|
11173
|
-
respondJson(res, 200, { synthesis: readFileSync21(
|
|
11253
|
+
respondJson(res, 200, { synthesis: readFileSync21(path91, "utf8") });
|
|
11174
11254
|
} catch {
|
|
11175
11255
|
respondJson(res, 404, { error: "No synthesis found" });
|
|
11176
11256
|
}
|
|
@@ -11253,8 +11333,8 @@ function parseDiffNameStatus(output) {
|
|
|
11253
11333
|
if (!status3 || fields.length < 2) continue;
|
|
11254
11334
|
const category = categorize(status3[0]);
|
|
11255
11335
|
if (!category) continue;
|
|
11256
|
-
const
|
|
11257
|
-
if (
|
|
11336
|
+
const path91 = fields[fields.length - 1];
|
|
11337
|
+
if (path91) result[category].push(path91);
|
|
11258
11338
|
}
|
|
11259
11339
|
return result;
|
|
11260
11340
|
}
|
|
@@ -11390,21 +11470,21 @@ function subsequenceScore(text18, query) {
|
|
|
11390
11470
|
}
|
|
11391
11471
|
return score - Math.min(text18.length, MAX_LENGTH_PENALTY);
|
|
11392
11472
|
}
|
|
11393
|
-
function scoreFilePath(
|
|
11473
|
+
function scoreFilePath(path91, query) {
|
|
11394
11474
|
const needle = query.trim().toLowerCase();
|
|
11395
11475
|
if (!needle) return 0;
|
|
11396
|
-
const
|
|
11397
|
-
const inBasename = subsequenceScore(
|
|
11476
|
+
const basename28 = path91.slice(path91.lastIndexOf("/") + 1);
|
|
11477
|
+
const inBasename = subsequenceScore(basename28, needle);
|
|
11398
11478
|
if (inBasename !== null) return BASENAME_WEIGHT + inBasename;
|
|
11399
|
-
return subsequenceScore(
|
|
11479
|
+
return subsequenceScore(path91, needle);
|
|
11400
11480
|
}
|
|
11401
11481
|
|
|
11402
11482
|
// src/commands/sessions/web/rankFilePaths.ts
|
|
11403
11483
|
function rankFilePaths(paths, query, limit) {
|
|
11404
11484
|
const scored = [];
|
|
11405
|
-
for (const
|
|
11406
|
-
const score = scoreFilePath(
|
|
11407
|
-
if (score !== null) scored.push({ path:
|
|
11485
|
+
for (const path91 of paths) {
|
|
11486
|
+
const score = scoreFilePath(path91, query);
|
|
11487
|
+
if (score !== null) scored.push({ path: path91, score });
|
|
11408
11488
|
}
|
|
11409
11489
|
scored.sort((a, b) => b.score - a.score || a.path.localeCompare(b.path));
|
|
11410
11490
|
return scored.slice(0, limit).map((entry) => entry.path);
|
|
@@ -11563,11 +11643,11 @@ async function listNewsItems(_req, res) {
|
|
|
11563
11643
|
}
|
|
11564
11644
|
|
|
11565
11645
|
// src/commands/sessions/web/listScopedRules.ts
|
|
11566
|
-
import
|
|
11646
|
+
import path33 from "path";
|
|
11567
11647
|
|
|
11568
11648
|
// src/commands/rules/readScopedRules.ts
|
|
11569
11649
|
import { existsSync as existsSync34, readFileSync as readFileSync22 } from "fs";
|
|
11570
|
-
import
|
|
11650
|
+
import path32 from "path";
|
|
11571
11651
|
|
|
11572
11652
|
// src/commands/rules/rulesSectionRange.ts
|
|
11573
11653
|
var RULES_HEADING = /^##\s+rules\s*$/i;
|
|
@@ -11616,10 +11696,10 @@ function parseRulesSection(content) {
|
|
|
11616
11696
|
|
|
11617
11697
|
// src/commands/rules/scopeDirectory.ts
|
|
11618
11698
|
import { existsSync as existsSync33, statSync as statSync5 } from "fs";
|
|
11619
|
-
import
|
|
11699
|
+
import path31 from "path";
|
|
11620
11700
|
function scopeDirectory(target) {
|
|
11621
|
-
const resolved =
|
|
11622
|
-
return existsSync33(resolved) && statSync5(resolved).isDirectory() ? resolved :
|
|
11701
|
+
const resolved = path31.resolve(target);
|
|
11702
|
+
return existsSync33(resolved) && statSync5(resolved).isDirectory() ? resolved : path31.dirname(resolved);
|
|
11623
11703
|
}
|
|
11624
11704
|
|
|
11625
11705
|
// src/commands/rules/readScopedRules.ts
|
|
@@ -11629,10 +11709,10 @@ function scopedClaudeFiles(target) {
|
|
|
11629
11709
|
const files = [];
|
|
11630
11710
|
let current = startDir;
|
|
11631
11711
|
while (true) {
|
|
11632
|
-
const candidate =
|
|
11712
|
+
const candidate = path32.join(current, "CLAUDE.md");
|
|
11633
11713
|
if (existsSync34(candidate)) files.push(candidate);
|
|
11634
|
-
if (current === root || current ===
|
|
11635
|
-
current =
|
|
11714
|
+
if (current === root || current === path32.dirname(current)) break;
|
|
11715
|
+
current = path32.dirname(current);
|
|
11636
11716
|
}
|
|
11637
11717
|
return files;
|
|
11638
11718
|
}
|
|
@@ -11663,7 +11743,7 @@ function listScopedRules(req, res) {
|
|
|
11663
11743
|
respondJson(res, 200, {
|
|
11664
11744
|
rules: readScopedRules(target).map((rule) => ({
|
|
11665
11745
|
...rule,
|
|
11666
|
-
source:
|
|
11746
|
+
source: path33.relative(root, rule.source) || rule.source
|
|
11667
11747
|
}))
|
|
11668
11748
|
});
|
|
11669
11749
|
} catch {
|
|
@@ -12145,38 +12225,38 @@ async function restartWeb(req, res, deps2 = {}) {
|
|
|
12145
12225
|
import { relative as relative3 } from "path";
|
|
12146
12226
|
|
|
12147
12227
|
// src/commands/sessions/web/revertPathChanges.ts
|
|
12148
|
-
async function isTracked(cwd,
|
|
12228
|
+
async function isTracked(cwd, path91) {
|
|
12149
12229
|
try {
|
|
12150
|
-
await execGit(cwd, ["ls-files", "--error-unmatch", "--",
|
|
12230
|
+
await execGit(cwd, ["ls-files", "--error-unmatch", "--", path91]);
|
|
12151
12231
|
return true;
|
|
12152
12232
|
} catch {
|
|
12153
12233
|
return false;
|
|
12154
12234
|
}
|
|
12155
12235
|
}
|
|
12156
|
-
async function isInHead(cwd,
|
|
12157
|
-
const listing = await execGit(cwd, ["ls-tree", "HEAD", "--",
|
|
12236
|
+
async function isInHead(cwd, path91) {
|
|
12237
|
+
const listing = await execGit(cwd, ["ls-tree", "HEAD", "--", path91]);
|
|
12158
12238
|
return listing.trim().length > 0;
|
|
12159
12239
|
}
|
|
12160
|
-
async function revertPathChanges(cwd,
|
|
12161
|
-
if (!await isTracked(cwd,
|
|
12162
|
-
await execGit(cwd, ["clean", "-f", "--",
|
|
12240
|
+
async function revertPathChanges(cwd, path91) {
|
|
12241
|
+
if (!await isTracked(cwd, path91)) {
|
|
12242
|
+
await execGit(cwd, ["clean", "-f", "--", path91]);
|
|
12163
12243
|
return;
|
|
12164
12244
|
}
|
|
12165
|
-
if (await isInHead(cwd,
|
|
12166
|
-
await execGit(cwd, ["checkout", "HEAD", "--",
|
|
12245
|
+
if (await isInHead(cwd, path91)) {
|
|
12246
|
+
await execGit(cwd, ["checkout", "HEAD", "--", path91]);
|
|
12167
12247
|
return;
|
|
12168
12248
|
}
|
|
12169
|
-
await execGit(cwd, ["rm", "-f", "--",
|
|
12249
|
+
await execGit(cwd, ["rm", "-f", "--", path91]);
|
|
12170
12250
|
}
|
|
12171
12251
|
|
|
12172
12252
|
// src/commands/sessions/web/revertDiffFile.ts
|
|
12173
12253
|
async function revertDiffFile(req, res) {
|
|
12174
12254
|
const resolved = getFileTarget(req, res);
|
|
12175
12255
|
if (!resolved) return;
|
|
12176
|
-
const
|
|
12256
|
+
const path91 = relative3(repoRoot(resolved.cwd), resolved.target);
|
|
12177
12257
|
try {
|
|
12178
|
-
await revertPathChanges(resolved.cwd,
|
|
12179
|
-
respondJson(res, 200, { reverted:
|
|
12258
|
+
await revertPathChanges(resolved.cwd, path91);
|
|
12259
|
+
respondJson(res, 200, { reverted: path91 });
|
|
12180
12260
|
} catch (error) {
|
|
12181
12261
|
respondJson(res, 500, {
|
|
12182
12262
|
error: error instanceof Error ? error.message : "Failed to revert file"
|
|
@@ -12198,7 +12278,7 @@ async function readJsonBody(req) {
|
|
|
12198
12278
|
function requestedPaths(body) {
|
|
12199
12279
|
const paths = body.paths;
|
|
12200
12280
|
if (!Array.isArray(paths)) return null;
|
|
12201
|
-
if (paths.some((
|
|
12281
|
+
if (paths.some((path91) => typeof path91 !== "string")) return null;
|
|
12202
12282
|
return paths;
|
|
12203
12283
|
}
|
|
12204
12284
|
async function revertDiffPaths(req, res) {
|
|
@@ -12218,10 +12298,10 @@ async function revertDiffPaths(req, res) {
|
|
|
12218
12298
|
const root = repoRoot(cwd);
|
|
12219
12299
|
const reverted = [];
|
|
12220
12300
|
const failed2 = [];
|
|
12221
|
-
for (const
|
|
12222
|
-
const target = resolveWithinCwd(cwd,
|
|
12301
|
+
for (const path91 of paths) {
|
|
12302
|
+
const target = resolveWithinCwd(cwd, path91);
|
|
12223
12303
|
if (!target) {
|
|
12224
|
-
failed2.push({ path:
|
|
12304
|
+
failed2.push({ path: path91, error: "Path outside cwd" });
|
|
12225
12305
|
continue;
|
|
12226
12306
|
}
|
|
12227
12307
|
const relativePath = relative4(root, target);
|
|
@@ -12311,11 +12391,11 @@ function coerceStructuredConfigValue(key, raw) {
|
|
|
12311
12391
|
};
|
|
12312
12392
|
}
|
|
12313
12393
|
function formatIssue(key, issue) {
|
|
12314
|
-
const
|
|
12394
|
+
const path91 = formatConfigPath([
|
|
12315
12395
|
{ kind: "key", name: key },
|
|
12316
12396
|
...issue.path.map(toSegment)
|
|
12317
12397
|
]);
|
|
12318
|
-
return `${
|
|
12398
|
+
return `${path91}: ${issue.message}`;
|
|
12319
12399
|
}
|
|
12320
12400
|
function toSegment(part) {
|
|
12321
12401
|
return typeof part === "number" ? { kind: "index", index: part } : { kind: "key", name: String(part) };
|
|
@@ -12410,9 +12490,9 @@ function coerceUnion(key, raw, types) {
|
|
|
12410
12490
|
}
|
|
12411
12491
|
|
|
12412
12492
|
// src/shared/valueAtConfigPath.ts
|
|
12413
|
-
function valueAtConfigPath(value,
|
|
12493
|
+
function valueAtConfigPath(value, path91) {
|
|
12414
12494
|
let current = value;
|
|
12415
|
-
for (const key of
|
|
12495
|
+
for (const key of path91) {
|
|
12416
12496
|
if (typeof key === "number") {
|
|
12417
12497
|
if (!Array.isArray(current)) return void 0;
|
|
12418
12498
|
current = current[key];
|
|
@@ -12429,7 +12509,7 @@ function restoreConfigSecrets(value, stored, node) {
|
|
|
12429
12509
|
return mapConfigSecrets(
|
|
12430
12510
|
value,
|
|
12431
12511
|
node,
|
|
12432
|
-
(secret,
|
|
12512
|
+
(secret, path91) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path91) : secret
|
|
12433
12513
|
);
|
|
12434
12514
|
}
|
|
12435
12515
|
|
|
@@ -12478,8 +12558,8 @@ function stepIntoNested(container, key, nextKey) {
|
|
|
12478
12558
|
}
|
|
12479
12559
|
return ensureObject(container, resolved);
|
|
12480
12560
|
}
|
|
12481
|
-
function setNestedValue(obj,
|
|
12482
|
-
const keys =
|
|
12561
|
+
function setNestedValue(obj, path91, value) {
|
|
12562
|
+
const keys = path91.split(".");
|
|
12483
12563
|
const result = { ...obj };
|
|
12484
12564
|
let current = result;
|
|
12485
12565
|
for (let i = 0; i < keys.length - 1; i++) {
|
|
@@ -12506,8 +12586,8 @@ function formatIssue2(issue, key) {
|
|
|
12506
12586
|
return issue.keys.map(
|
|
12507
12587
|
(unrecognized) => `${[...issue.path, unrecognized].join(".")}: Unrecognized key`
|
|
12508
12588
|
);
|
|
12509
|
-
const
|
|
12510
|
-
return [`${
|
|
12589
|
+
const path91 = issue.path.length > 0 ? issue.path.join(".") : key;
|
|
12590
|
+
return [`${path91}: ${issue.message}`];
|
|
12511
12591
|
}
|
|
12512
12592
|
|
|
12513
12593
|
// src/commands/config/applyConfigSet.ts
|
|
@@ -12764,8 +12844,8 @@ function removeAt(container, keys) {
|
|
|
12764
12844
|
}
|
|
12765
12845
|
return removeFromChild(container, key, rest);
|
|
12766
12846
|
}
|
|
12767
|
-
function unsetNestedValue(obj,
|
|
12768
|
-
const { container, removed } = removeAt(obj,
|
|
12847
|
+
function unsetNestedValue(obj, path91) {
|
|
12848
|
+
const { container, removed } = removeAt(obj, path91.split("."));
|
|
12769
12849
|
return { config: container, removed };
|
|
12770
12850
|
}
|
|
12771
12851
|
|
|
@@ -13549,7 +13629,7 @@ import chalk63 from "chalk";
|
|
|
13549
13629
|
|
|
13550
13630
|
// src/commands/sessions/shared/resolveSessionTranscript.ts
|
|
13551
13631
|
import * as fs22 from "fs";
|
|
13552
|
-
import * as
|
|
13632
|
+
import * as path35 from "path";
|
|
13553
13633
|
|
|
13554
13634
|
// src/commands/sessions/summarise/readTranscriptHead.ts
|
|
13555
13635
|
import * as fs21 from "fs";
|
|
@@ -13570,9 +13650,9 @@ function readTranscriptHead(filePath, maxBytes = 65536) {
|
|
|
13570
13650
|
|
|
13571
13651
|
// src/commands/sessions/shared/claudeProjectsRoot.ts
|
|
13572
13652
|
import * as os4 from "os";
|
|
13573
|
-
import * as
|
|
13653
|
+
import * as path34 from "path";
|
|
13574
13654
|
function claudeProjectsRoot() {
|
|
13575
|
-
return
|
|
13655
|
+
return path34.join(os4.homedir(), ".claude", "projects");
|
|
13576
13656
|
}
|
|
13577
13657
|
function projectSlug(cwd) {
|
|
13578
13658
|
return cwd.replace(/[^a-zA-Z0-9]/g, "-");
|
|
@@ -13595,7 +13675,7 @@ function findTranscriptFile(sessionId, projectsRoot) {
|
|
|
13595
13675
|
return void 0;
|
|
13596
13676
|
}
|
|
13597
13677
|
for (const dir of projectDirs) {
|
|
13598
|
-
const candidate =
|
|
13678
|
+
const candidate = path35.join(projectsRoot, dir, `${sessionId}.jsonl`);
|
|
13599
13679
|
if (fs22.existsSync(candidate)) return candidate;
|
|
13600
13680
|
}
|
|
13601
13681
|
return void 0;
|
|
@@ -13647,12 +13727,12 @@ import chalk64 from "chalk";
|
|
|
13647
13727
|
|
|
13648
13728
|
// src/commands/sessions/shared/resolveCurrentSessionId.ts
|
|
13649
13729
|
import * as fs23 from "fs";
|
|
13650
|
-
import * as
|
|
13730
|
+
import * as path36 from "path";
|
|
13651
13731
|
var SESSION_ID_ENV = "CLAUDE_CODE_SESSION_ID";
|
|
13652
13732
|
function resolveCurrentSessionId(options2 = {}) {
|
|
13653
13733
|
const fromEnv = (options2.env ?? process.env)[SESSION_ID_ENV];
|
|
13654
13734
|
if (fromEnv) return fromEnv;
|
|
13655
|
-
const dir =
|
|
13735
|
+
const dir = path36.join(
|
|
13656
13736
|
options2.projectsRoot ?? claudeProjectsRoot(),
|
|
13657
13737
|
projectSlug(options2.cwd ?? process.cwd())
|
|
13658
13738
|
);
|
|
@@ -13668,10 +13748,10 @@ function newestTranscriptId(dir) {
|
|
|
13668
13748
|
let newest;
|
|
13669
13749
|
for (const entry of entries) {
|
|
13670
13750
|
if (!entry.endsWith(".jsonl")) continue;
|
|
13671
|
-
const modifiedAt = modifiedAtOf(
|
|
13751
|
+
const modifiedAt = modifiedAtOf(path36.join(dir, entry));
|
|
13672
13752
|
if (modifiedAt === void 0) continue;
|
|
13673
13753
|
if (!newest || modifiedAt > newest.modifiedAt)
|
|
13674
|
-
newest = { id:
|
|
13754
|
+
newest = { id: path36.basename(entry, ".jsonl"), modifiedAt };
|
|
13675
13755
|
}
|
|
13676
13756
|
return newest?.id;
|
|
13677
13757
|
}
|
|
@@ -13908,9 +13988,9 @@ function originToSshUrl(origin) {
|
|
|
13908
13988
|
const firstSlash = origin.indexOf("/");
|
|
13909
13989
|
if (firstSlash <= 0) return null;
|
|
13910
13990
|
const host = origin.slice(0, firstSlash);
|
|
13911
|
-
const
|
|
13912
|
-
if (!
|
|
13913
|
-
return `git@${host}:${
|
|
13991
|
+
const path91 = origin.slice(firstSlash + 1);
|
|
13992
|
+
if (!path91) return null;
|
|
13993
|
+
return `git@${host}:${path91}.git`;
|
|
13914
13994
|
}
|
|
13915
13995
|
|
|
13916
13996
|
// src/commands/backlog/cloneRepo.ts
|
|
@@ -16538,7 +16618,7 @@ function registerBranch(program2) {
|
|
|
16538
16618
|
}
|
|
16539
16619
|
|
|
16540
16620
|
// src/commands/cliHook/index.ts
|
|
16541
|
-
import { basename as
|
|
16621
|
+
import { basename as basename12 } from "path";
|
|
16542
16622
|
|
|
16543
16623
|
// src/shared/splitCompound.ts
|
|
16544
16624
|
import { parse } from "shell-quote";
|
|
@@ -16935,13 +17015,13 @@ function findBuiltinDenyRaw(rawCommand) {
|
|
|
16935
17015
|
|
|
16936
17016
|
// src/commands/cliHook/findRestrictedPathDeny.ts
|
|
16937
17017
|
var RESTRICTED_PATHS = [".assist/restricted"];
|
|
16938
|
-
function restrictedPathRegex(
|
|
16939
|
-
const pattern2 =
|
|
17018
|
+
function restrictedPathRegex(path91) {
|
|
17019
|
+
const pattern2 = path91.split("/").map((segment) => segment.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`)).join(String.raw`[/\\]`);
|
|
16940
17020
|
return new RegExp(pattern2);
|
|
16941
17021
|
}
|
|
16942
|
-
var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((
|
|
16943
|
-
path:
|
|
16944
|
-
regex: restrictedPathRegex(
|
|
17022
|
+
var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((path91) => ({
|
|
17023
|
+
path: path91,
|
|
17024
|
+
regex: restrictedPathRegex(path91)
|
|
16945
17025
|
}));
|
|
16946
17026
|
function findRestrictedPathDenyRaw(rawCommand) {
|
|
16947
17027
|
const rule = RESTRICTED_PATH_RULES.find(
|
|
@@ -17090,9 +17170,9 @@ var __dirname4 = dirname23(__filename3);
|
|
|
17090
17170
|
function packageRoot() {
|
|
17091
17171
|
return __dirname4;
|
|
17092
17172
|
}
|
|
17093
|
-
function readLines(
|
|
17094
|
-
if (!existsSync38(
|
|
17095
|
-
return readFileSync26(
|
|
17173
|
+
function readLines(path91) {
|
|
17174
|
+
if (!existsSync38(path91)) return [];
|
|
17175
|
+
return readFileSync26(path91, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
17096
17176
|
}
|
|
17097
17177
|
var cachedReads;
|
|
17098
17178
|
var cachedWrites;
|
|
@@ -17455,7 +17535,7 @@ async function cliHook() {
|
|
|
17455
17535
|
logDeniedToolCall({
|
|
17456
17536
|
tool: input.toolName,
|
|
17457
17537
|
command: input.command,
|
|
17458
|
-
repo:
|
|
17538
|
+
repo: basename12(process.cwd()),
|
|
17459
17539
|
sessionId: process.env.CLAUDE_SESSION_ID,
|
|
17460
17540
|
denyReason: decision.permissionDecisionReason
|
|
17461
17541
|
});
|
|
@@ -17616,14 +17696,14 @@ function showProgress(p, label2) {
|
|
|
17616
17696
|
const pct = Math.round(p.done / p.total * 100);
|
|
17617
17697
|
process.stderr.write(`\r\x1B[K[${pct}%] Scanning ${label2}...`);
|
|
17618
17698
|
}
|
|
17619
|
-
async function resolveCommand(cli,
|
|
17620
|
-
showProgress(p,
|
|
17621
|
-
const subHelp = await runHelp([cli, ...
|
|
17699
|
+
async function resolveCommand(cli, path91, description, depth, p) {
|
|
17700
|
+
showProgress(p, path91.join(" "));
|
|
17701
|
+
const subHelp = await runHelp([cli, ...path91]);
|
|
17622
17702
|
if (!subHelp || !hasSubcommands(subHelp)) {
|
|
17623
|
-
return [{ path:
|
|
17703
|
+
return [{ path: path91, description }];
|
|
17624
17704
|
}
|
|
17625
|
-
const children = await discoverAt(cli,
|
|
17626
|
-
return children.length > 0 ? children : [{ path:
|
|
17705
|
+
const children = await discoverAt(cli, path91, depth + 1, p);
|
|
17706
|
+
return children.length > 0 ? children : [{ path: path91, description }];
|
|
17627
17707
|
}
|
|
17628
17708
|
async function discoverAt(cli, parentPath, depth, p) {
|
|
17629
17709
|
if (depth > SAFETY_DEPTH) return [];
|
|
@@ -17771,9 +17851,9 @@ function logPath(cli) {
|
|
|
17771
17851
|
return join39(homedir17(), ".assist", `cli-discover-${safeName}.log`);
|
|
17772
17852
|
}
|
|
17773
17853
|
function readCache(cli) {
|
|
17774
|
-
const
|
|
17775
|
-
if (!existsSync40(
|
|
17776
|
-
return readFileSync28(
|
|
17854
|
+
const path91 = logPath(cli);
|
|
17855
|
+
if (!existsSync40(path91)) return void 0;
|
|
17856
|
+
return readFileSync28(path91, "utf8");
|
|
17777
17857
|
}
|
|
17778
17858
|
function writeCache(cli, output) {
|
|
17779
17859
|
const dir = join39(homedir17(), ".assist");
|
|
@@ -17933,9 +18013,9 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
17933
18013
|
}
|
|
17934
18014
|
const cutoff = Date.now() - STALE_AFTER_MS;
|
|
17935
18015
|
for (const entry of entries) {
|
|
17936
|
-
const
|
|
18016
|
+
const path91 = join41(dir, entry);
|
|
17937
18017
|
try {
|
|
17938
|
-
if (statSync7(
|
|
18018
|
+
if (statSync7(path91).mtimeMs < cutoff) unlinkSync7(path91);
|
|
17939
18019
|
} catch {
|
|
17940
18020
|
continue;
|
|
17941
18021
|
}
|
|
@@ -17945,10 +18025,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
17945
18025
|
// src/commands/codeComment/readPinState.ts
|
|
17946
18026
|
import { existsSync as existsSync41, readFileSync as readFileSync29 } from "fs";
|
|
17947
18027
|
function readPinState(pin) {
|
|
17948
|
-
const
|
|
17949
|
-
if (!existsSync41(
|
|
18028
|
+
const path91 = getPinStatePath(pin);
|
|
18029
|
+
if (!existsSync41(path91)) return void 0;
|
|
17950
18030
|
try {
|
|
17951
|
-
const state = JSON.parse(readFileSync29(
|
|
18031
|
+
const state = JSON.parse(readFileSync29(path91, "utf8"));
|
|
17952
18032
|
if (state.pin !== pin) return void 0;
|
|
17953
18033
|
return state;
|
|
17954
18034
|
} catch {
|
|
@@ -18280,8 +18360,8 @@ function findUnmergedPaths() {
|
|
|
18280
18360
|
}
|
|
18281
18361
|
const found = /* @__PURE__ */ new Set();
|
|
18282
18362
|
for (const line of output.split("\n")) {
|
|
18283
|
-
const
|
|
18284
|
-
if (
|
|
18363
|
+
const path91 = line.split(" ")[1];
|
|
18364
|
+
if (path91) found.add(path91.trim());
|
|
18285
18365
|
}
|
|
18286
18366
|
return [...found];
|
|
18287
18367
|
}
|
|
@@ -18603,13 +18683,13 @@ import chalk125 from "chalk";
|
|
|
18603
18683
|
|
|
18604
18684
|
// src/commands/complexity/shared/index.ts
|
|
18605
18685
|
import fs25 from "fs";
|
|
18606
|
-
import
|
|
18686
|
+
import path38 from "path";
|
|
18607
18687
|
import chalk124 from "chalk";
|
|
18608
18688
|
import ts5 from "typescript";
|
|
18609
18689
|
|
|
18610
18690
|
// src/commands/complexity/findSourceFiles.ts
|
|
18611
18691
|
import fs24 from "fs";
|
|
18612
|
-
import
|
|
18692
|
+
import path37 from "path";
|
|
18613
18693
|
import { minimatch as minimatch5 } from "minimatch";
|
|
18614
18694
|
function applyIgnoreGlobs(files, extraIgnore = []) {
|
|
18615
18695
|
const { complexity } = loadConfig();
|
|
@@ -18623,7 +18703,7 @@ function walk2(dir, results) {
|
|
|
18623
18703
|
const extensions = [".ts", ".tsx"];
|
|
18624
18704
|
const entries = fs24.readdirSync(dir, { withFileTypes: true });
|
|
18625
18705
|
for (const entry of entries) {
|
|
18626
|
-
const fullPath =
|
|
18706
|
+
const fullPath = path37.join(dir, entry.name);
|
|
18627
18707
|
if (entry.isDirectory()) {
|
|
18628
18708
|
if (entry.name !== "node_modules" && entry.name !== ".git") {
|
|
18629
18709
|
walk2(fullPath, results);
|
|
@@ -18845,7 +18925,7 @@ function countSloc(content) {
|
|
|
18845
18925
|
function createSourceFromFile(filePath) {
|
|
18846
18926
|
const content = fs25.readFileSync(filePath, "utf8");
|
|
18847
18927
|
return ts5.createSourceFile(
|
|
18848
|
-
|
|
18928
|
+
path38.basename(filePath),
|
|
18849
18929
|
content,
|
|
18850
18930
|
ts5.ScriptTarget.Latest,
|
|
18851
18931
|
true,
|
|
@@ -19007,12 +19087,12 @@ function formatResultLine(entry, failing) {
|
|
|
19007
19087
|
|
|
19008
19088
|
// src/commands/complexity/maintainability/getMaintainabilityGitState.ts
|
|
19009
19089
|
import { execSync as execSync36 } from "child_process";
|
|
19010
|
-
import
|
|
19090
|
+
import path39 from "path";
|
|
19011
19091
|
function git3(command) {
|
|
19012
19092
|
return execSync36(command, { encoding: "utf8" });
|
|
19013
19093
|
}
|
|
19014
19094
|
function toAbsolute(root, repoRelative) {
|
|
19015
|
-
return
|
|
19095
|
+
return path39.resolve(root, repoRelative);
|
|
19016
19096
|
}
|
|
19017
19097
|
function collectShrunkFiles(root) {
|
|
19018
19098
|
const shrunk = /* @__PURE__ */ new Set();
|
|
@@ -19052,7 +19132,7 @@ function getMaintainabilityGitState() {
|
|
|
19052
19132
|
}
|
|
19053
19133
|
|
|
19054
19134
|
// src/commands/complexity/maintainability/printMaintainabilityFailure.ts
|
|
19055
|
-
import
|
|
19135
|
+
import path40 from "path";
|
|
19056
19136
|
import chalk128 from "chalk";
|
|
19057
19137
|
var extractTemplate = "assist refactor extract <file> <functionName> <destination> --apply";
|
|
19058
19138
|
function remediationLine(entry) {
|
|
@@ -19061,7 +19141,7 @@ function remediationLine(entry) {
|
|
|
19061
19141
|
${chalk128.cyan(extractTemplate)}`;
|
|
19062
19142
|
}
|
|
19063
19143
|
function cheatLine(entry, gitState) {
|
|
19064
|
-
const shrank = gitState.shrunkFiles.has(
|
|
19144
|
+
const shrank = gitState.shrunkFiles.has(path40.resolve(entry.file));
|
|
19065
19145
|
if (!shrank || gitState.newFileCreated) return "";
|
|
19066
19146
|
return `
|
|
19067
19147
|
${chalk128.red("\u2717 You shrank existing lines in this file without creating a new file. That cannot clear the gate \u2014 extract a responsibility to a new file.")}`;
|
|
@@ -19506,11 +19586,11 @@ async function loadPath(source) {
|
|
|
19506
19586
|
}
|
|
19507
19587
|
}
|
|
19508
19588
|
async function criteriaExtension() {
|
|
19509
|
-
const
|
|
19589
|
+
const path91 = await loadPath(criteriaExtensionDir());
|
|
19510
19590
|
console.log(
|
|
19511
19591
|
chalk139.bold("acceptance criteria outliner \u2014 GitHub browser extension")
|
|
19512
19592
|
);
|
|
19513
|
-
console.log(chalk139.dim(`load the unpacked extension from ${
|
|
19593
|
+
console.log(chalk139.dim(`load the unpacked extension from ${path91}`));
|
|
19514
19594
|
}
|
|
19515
19595
|
|
|
19516
19596
|
// src/commands/criteriaExtension/signCriteriaExtension.ts
|
|
@@ -19635,10 +19715,10 @@ async function signCriteriaExtension() {
|
|
|
19635
19715
|
process.exitCode = 1;
|
|
19636
19716
|
return;
|
|
19637
19717
|
}
|
|
19638
|
-
const
|
|
19718
|
+
const path91 = await signedAddonInstallPath(
|
|
19639
19719
|
await copySignedXpi(xpi, ARTIFACTS_DIR)
|
|
19640
19720
|
);
|
|
19641
|
-
console.log(chalk141.dim(`install the signed add-on from ${
|
|
19721
|
+
console.log(chalk141.dim(`install the signed add-on from ${path91}`));
|
|
19642
19722
|
}
|
|
19643
19723
|
|
|
19644
19724
|
// src/commands/registerCriteriaExtension.ts
|
|
@@ -19736,10 +19816,10 @@ function getMigrationApprovalPath(migrationId) {
|
|
|
19736
19816
|
// src/commands/dbMigration/readMigrationPinState.ts
|
|
19737
19817
|
import { existsSync as existsSync46, readFileSync as readFileSync31 } from "fs";
|
|
19738
19818
|
function readMigrationPinState(pin) {
|
|
19739
|
-
const
|
|
19740
|
-
if (!existsSync46(
|
|
19819
|
+
const path91 = getMigrationPinPath(pin);
|
|
19820
|
+
if (!existsSync46(path91)) return void 0;
|
|
19741
19821
|
try {
|
|
19742
|
-
const state = JSON.parse(readFileSync31(
|
|
19822
|
+
const state = JSON.parse(readFileSync31(path91, "utf8"));
|
|
19743
19823
|
if (state.pin !== pin) return void 0;
|
|
19744
19824
|
if (!Number.isInteger(state.migrationId)) return void 0;
|
|
19745
19825
|
return state;
|
|
@@ -19864,7 +19944,7 @@ function registerDeploy(program2) {
|
|
|
19864
19944
|
|
|
19865
19945
|
// src/commands/devlog/list/index.ts
|
|
19866
19946
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
19867
|
-
import { basename as
|
|
19947
|
+
import { basename as basename14 } from "path";
|
|
19868
19948
|
|
|
19869
19949
|
// src/commands/devlog/loadBlogSkipDays.ts
|
|
19870
19950
|
import { homedir as homedir20 } from "os";
|
|
@@ -19883,7 +19963,7 @@ import chalk146 from "chalk";
|
|
|
19883
19963
|
|
|
19884
19964
|
// src/shared/getRepoName.ts
|
|
19885
19965
|
import { existsSync as existsSync48, readFileSync as readFileSync33 } from "fs";
|
|
19886
|
-
import { basename as
|
|
19966
|
+
import { basename as basename13, join as join50 } from "path";
|
|
19887
19967
|
function getRepoName() {
|
|
19888
19968
|
const config = loadConfig();
|
|
19889
19969
|
if (config.devlog?.name) {
|
|
@@ -19900,7 +19980,7 @@ function getRepoName() {
|
|
|
19900
19980
|
} catch {
|
|
19901
19981
|
}
|
|
19902
19982
|
}
|
|
19903
|
-
return
|
|
19983
|
+
return basename13(process.cwd());
|
|
19904
19984
|
}
|
|
19905
19985
|
|
|
19906
19986
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
@@ -20036,7 +20116,7 @@ function list3(options2) {
|
|
|
20036
20116
|
const config = loadConfig();
|
|
20037
20117
|
const days = options2.days ?? 30;
|
|
20038
20118
|
const ignore3 = options2.ignore ?? config.devlog?.ignore ?? [];
|
|
20039
|
-
const repoName =
|
|
20119
|
+
const repoName = basename14(process.cwd());
|
|
20040
20120
|
const skipDays = loadBlogSkipDays(repoName);
|
|
20041
20121
|
const devlogEntries = loadDevlogEntries(repoName);
|
|
20042
20122
|
const args = ["log"];
|
|
@@ -20448,7 +20528,7 @@ async function checkBuildLocksCommand() {
|
|
|
20448
20528
|
|
|
20449
20529
|
// src/commands/dotnet/buildTree.ts
|
|
20450
20530
|
import { readFileSync as readFileSync35 } from "fs";
|
|
20451
|
-
import
|
|
20531
|
+
import path41 from "path";
|
|
20452
20532
|
var PROJECT_REF_RE = /<ProjectReference\s+Include="([^"]+)"/g;
|
|
20453
20533
|
function getProjectRefs(csprojPath) {
|
|
20454
20534
|
const content = readFileSync35(csprojPath, "utf8");
|
|
@@ -20459,14 +20539,14 @@ function getProjectRefs(csprojPath) {
|
|
|
20459
20539
|
return refs;
|
|
20460
20540
|
}
|
|
20461
20541
|
function buildTree(csprojPath, repoRoot2, visited = /* @__PURE__ */ new Set()) {
|
|
20462
|
-
const abs =
|
|
20463
|
-
const rel =
|
|
20542
|
+
const abs = path41.resolve(csprojPath);
|
|
20543
|
+
const rel = path41.relative(repoRoot2, abs);
|
|
20464
20544
|
const node = { path: abs, relativePath: rel, children: [] };
|
|
20465
20545
|
if (visited.has(abs)) return node;
|
|
20466
20546
|
visited.add(abs);
|
|
20467
|
-
const dir =
|
|
20547
|
+
const dir = path41.dirname(abs);
|
|
20468
20548
|
for (const ref of getProjectRefs(abs)) {
|
|
20469
|
-
const childAbs =
|
|
20549
|
+
const childAbs = path41.resolve(dir, ref);
|
|
20470
20550
|
try {
|
|
20471
20551
|
readFileSync35(childAbs);
|
|
20472
20552
|
node.children.push(buildTree(childAbs, repoRoot2, visited));
|
|
@@ -20494,7 +20574,7 @@ function collectAllDeps(node) {
|
|
|
20494
20574
|
|
|
20495
20575
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
20496
20576
|
import { readdirSync as readdirSync8, readFileSync as readFileSync36, statSync as statSync8 } from "fs";
|
|
20497
|
-
import
|
|
20577
|
+
import path42 from "path";
|
|
20498
20578
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
20499
20579
|
if (depth > maxDepth) return [];
|
|
20500
20580
|
const results = [];
|
|
@@ -20507,7 +20587,7 @@ function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
|
20507
20587
|
for (const entry of entries) {
|
|
20508
20588
|
if (entry.startsWith(".") || entry === "node_modules" || entry === "packages")
|
|
20509
20589
|
continue;
|
|
20510
|
-
const full =
|
|
20590
|
+
const full = path42.join(dir, entry);
|
|
20511
20591
|
try {
|
|
20512
20592
|
const stat4 = statSync8(full);
|
|
20513
20593
|
if (stat4.isFile() && entry.endsWith(".sln")) {
|
|
@@ -20521,8 +20601,8 @@ function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
|
20521
20601
|
return results;
|
|
20522
20602
|
}
|
|
20523
20603
|
function findContainingSolutions(csprojPath, repoRoot2) {
|
|
20524
|
-
const csprojAbs =
|
|
20525
|
-
const csprojBasename =
|
|
20604
|
+
const csprojAbs = path42.resolve(csprojPath);
|
|
20605
|
+
const csprojBasename = path42.basename(csprojAbs);
|
|
20526
20606
|
const slnFiles = findSlnFiles(repoRoot2, 3);
|
|
20527
20607
|
const matches = [];
|
|
20528
20608
|
const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
|
|
@@ -20530,7 +20610,7 @@ function findContainingSolutions(csprojPath, repoRoot2) {
|
|
|
20530
20610
|
try {
|
|
20531
20611
|
const content = readFileSync36(sln, "utf8");
|
|
20532
20612
|
if (pattern2.test(content)) {
|
|
20533
|
-
matches.push(
|
|
20613
|
+
matches.push(path42.relative(repoRoot2, sln));
|
|
20534
20614
|
}
|
|
20535
20615
|
} catch {
|
|
20536
20616
|
}
|
|
@@ -20593,15 +20673,15 @@ function printJson(tree, totalCount, solutions) {
|
|
|
20593
20673
|
|
|
20594
20674
|
// src/commands/dotnet/resolveCsproj.ts
|
|
20595
20675
|
import { existsSync as existsSync49 } from "fs";
|
|
20596
|
-
import
|
|
20676
|
+
import path43 from "path";
|
|
20597
20677
|
import chalk155 from "chalk";
|
|
20598
20678
|
function resolveCsproj(csprojPath) {
|
|
20599
|
-
const resolved =
|
|
20679
|
+
const resolved = path43.resolve(csprojPath);
|
|
20600
20680
|
if (!existsSync49(resolved)) {
|
|
20601
20681
|
console.error(chalk155.red(`File not found: ${resolved}`));
|
|
20602
20682
|
process.exit(1);
|
|
20603
20683
|
}
|
|
20604
|
-
const repoRoot2 = findRepoRoot(
|
|
20684
|
+
const repoRoot2 = findRepoRoot(path43.dirname(resolved));
|
|
20605
20685
|
if (!repoRoot2) {
|
|
20606
20686
|
console.error(chalk155.red("Could not find git repository root"));
|
|
20607
20687
|
process.exit(1);
|
|
@@ -20766,7 +20846,7 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
20766
20846
|
|
|
20767
20847
|
// src/commands/dotnet/resolveSolution.ts
|
|
20768
20848
|
import { existsSync as existsSync50 } from "fs";
|
|
20769
|
-
import
|
|
20849
|
+
import path44 from "path";
|
|
20770
20850
|
import chalk159 from "chalk";
|
|
20771
20851
|
|
|
20772
20852
|
// src/commands/dotnet/findSolution.ts
|
|
@@ -20805,7 +20885,7 @@ function findSolution() {
|
|
|
20805
20885
|
// src/commands/dotnet/resolveSolution.ts
|
|
20806
20886
|
function resolveSolution(sln) {
|
|
20807
20887
|
if (sln) {
|
|
20808
|
-
const resolved =
|
|
20888
|
+
const resolved = path44.resolve(sln);
|
|
20809
20889
|
if (!existsSync50(resolved)) {
|
|
20810
20890
|
console.error(chalk159.red(`Solution file not found: ${resolved}`));
|
|
20811
20891
|
process.exit(1);
|
|
@@ -20848,7 +20928,7 @@ function parseInspectReport(json) {
|
|
|
20848
20928
|
import { execSync as execSync41 } from "child_process";
|
|
20849
20929
|
import { existsSync as existsSync51, readFileSync as readFileSync37, unlinkSync as unlinkSync10 } from "fs";
|
|
20850
20930
|
import { tmpdir as tmpdir5 } from "os";
|
|
20851
|
-
import
|
|
20931
|
+
import path45 from "path";
|
|
20852
20932
|
import chalk160 from "chalk";
|
|
20853
20933
|
function assertJbInstalled() {
|
|
20854
20934
|
try {
|
|
@@ -20862,7 +20942,7 @@ function assertJbInstalled() {
|
|
|
20862
20942
|
}
|
|
20863
20943
|
}
|
|
20864
20944
|
function runInspectCode(slnPath, include, swea) {
|
|
20865
|
-
const reportPath =
|
|
20945
|
+
const reportPath = path45.join(tmpdir5(), `inspect-${Date.now()}.xml`);
|
|
20866
20946
|
const includeFlag = include ? ` --include="${include}"` : "";
|
|
20867
20947
|
const sweaFlag = swea ? " --swea" : "";
|
|
20868
20948
|
try {
|
|
@@ -21169,10 +21249,10 @@ function decideCommentGuard(input, existingContent) {
|
|
|
21169
21249
|
import { existsSync as existsSync52, unlinkSync as unlinkSync11 } from "fs";
|
|
21170
21250
|
function consumeMigrationApproval(migrationId) {
|
|
21171
21251
|
sweepRestrictedDir();
|
|
21172
|
-
const
|
|
21173
|
-
if (!existsSync52(
|
|
21252
|
+
const path91 = getMigrationApprovalPath(migrationId);
|
|
21253
|
+
if (!existsSync52(path91)) return false;
|
|
21174
21254
|
try {
|
|
21175
|
-
unlinkSync11(
|
|
21255
|
+
unlinkSync11(path91);
|
|
21176
21256
|
return true;
|
|
21177
21257
|
} catch {
|
|
21178
21258
|
return false;
|
|
@@ -22984,7 +23064,7 @@ import {
|
|
|
22984
23064
|
rmSync as rmSync3,
|
|
22985
23065
|
statSync as statSync9
|
|
22986
23066
|
} from "fs";
|
|
22987
|
-
import { basename as
|
|
23067
|
+
import { basename as basename15, join as join59 } from "path";
|
|
22988
23068
|
|
|
22989
23069
|
// src/commands/handover/getHandoverPath.ts
|
|
22990
23070
|
import { join as join57 } from "path";
|
|
@@ -23055,7 +23135,7 @@ async function migrateFile(orm, origin, file, createdAt) {
|
|
|
23055
23135
|
async function migrateDiskHandovers(orm, origin, cwd = process.cwd()) {
|
|
23056
23136
|
let migrated = 0;
|
|
23057
23137
|
for (const file of collectMarkdown(getHandoversDir(cwd))) {
|
|
23058
|
-
const createdAt = parseArchiveTimestamp(
|
|
23138
|
+
const createdAt = parseArchiveTimestamp(basename15(file)) ?? statSync9(file).mtime;
|
|
23059
23139
|
await migrateFile(orm, origin, file, createdAt);
|
|
23060
23140
|
migrated++;
|
|
23061
23141
|
}
|
|
@@ -23408,25 +23488,25 @@ function recentDaemonLogLines() {
|
|
|
23408
23488
|
// src/commands/sessions/daemon/worktree/canonicalTreePath.ts
|
|
23409
23489
|
import { realpathSync as realpathSync2 } from "fs";
|
|
23410
23490
|
import { resolve as resolve14 } from "path";
|
|
23411
|
-
function canonicalTreePath(
|
|
23491
|
+
function canonicalTreePath(path91) {
|
|
23412
23492
|
try {
|
|
23413
|
-
return realpathSync2(
|
|
23493
|
+
return realpathSync2(path91);
|
|
23414
23494
|
} catch {
|
|
23415
|
-
return resolve14(
|
|
23495
|
+
return resolve14(path91);
|
|
23416
23496
|
}
|
|
23417
23497
|
}
|
|
23418
23498
|
|
|
23419
23499
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
23420
23500
|
import { existsSync as existsSync55 } from "fs";
|
|
23421
|
-
import { basename as
|
|
23501
|
+
import { basename as basename17, dirname as dirname26 } from "path";
|
|
23422
23502
|
|
|
23423
23503
|
// src/commands/sessions/daemon/worktree/planAllocation.ts
|
|
23424
|
-
import { basename as
|
|
23504
|
+
import { basename as basename16, join as join60 } from "path";
|
|
23425
23505
|
function planAllocation(clone, boundTreeRoots2) {
|
|
23426
23506
|
return boundTreeRoots2.has(clone) ? "spill" : "primary";
|
|
23427
23507
|
}
|
|
23428
23508
|
function nextWorktreePath(clone, base, isTaken) {
|
|
23429
|
-
const name =
|
|
23509
|
+
const name = basename16(clone);
|
|
23430
23510
|
for (let n = 2; n < 1e3; n++) {
|
|
23431
23511
|
const candidate = join60(base, `${name}-${n}`);
|
|
23432
23512
|
if (!isTaken(candidate)) return candidate;
|
|
@@ -23464,23 +23544,23 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
|
23464
23544
|
const base = strategy.root ? expandTilde2(strategy.root) : dirname26(clone);
|
|
23465
23545
|
const registered = new Set(listWorktreePaths(clone));
|
|
23466
23546
|
const branches = new Set(listLocalBranches(clone));
|
|
23467
|
-
const isTaken = (candidate) => registered.has(candidate) || existsSync55(candidate) || boundTreeRoots2.has(candidate) || branches.has(
|
|
23468
|
-
const
|
|
23547
|
+
const isTaken = (candidate) => registered.has(candidate) || existsSync55(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename17(candidate));
|
|
23548
|
+
const path91 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
|
|
23469
23549
|
const start3 = worktreeStartPoint(clone, strategy.trunk);
|
|
23470
23550
|
gitSync(clone, [
|
|
23471
23551
|
"worktree",
|
|
23472
23552
|
"add",
|
|
23473
23553
|
start3.track ? "--track" : "--no-track",
|
|
23474
23554
|
"-b",
|
|
23475
|
-
|
|
23476
|
-
|
|
23555
|
+
basename17(path91),
|
|
23556
|
+
path91,
|
|
23477
23557
|
start3.ref
|
|
23478
23558
|
]);
|
|
23479
|
-
recordWorktree(
|
|
23559
|
+
recordWorktree(path91, clone, getCurrentOrigin(clone));
|
|
23480
23560
|
daemonLog(
|
|
23481
|
-
start3.track ? `worktree allocated ${
|
|
23561
|
+
start3.track ? `worktree allocated ${path91} (branch ${basename17(path91)} tracking ${start3.ref}) for clone ${clone}` : `worktree allocated ${path91} (branch ${basename17(path91)} off ${start3.ref}, no mainline tracking) for clone ${clone}`
|
|
23482
23562
|
);
|
|
23483
|
-
return
|
|
23563
|
+
return path91;
|
|
23484
23564
|
}
|
|
23485
23565
|
|
|
23486
23566
|
// src/commands/sessions/daemon/worktree/keptInTree.ts
|
|
@@ -23621,13 +23701,13 @@ function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
|
|
|
23621
23701
|
if (forcedSpill) daemonLog(forcedSpill);
|
|
23622
23702
|
else if (reusesClone(clone, boundTreeRoots2, reuse))
|
|
23623
23703
|
return { cwd: clone, kind: "primary", created: false, clone };
|
|
23624
|
-
const
|
|
23704
|
+
const path91 = createWorktree(
|
|
23625
23705
|
clone,
|
|
23626
23706
|
{ root: cfg.root, trunk: cfg.trunk },
|
|
23627
23707
|
boundTreeRoots2,
|
|
23628
23708
|
options2.replacesTree
|
|
23629
23709
|
);
|
|
23630
|
-
return { cwd:
|
|
23710
|
+
return { cwd: path91, kind: "worktree", created: true, clone };
|
|
23631
23711
|
}
|
|
23632
23712
|
|
|
23633
23713
|
// src/commands/sessions/daemon/describePersistedSession.ts
|
|
@@ -23960,13 +24040,13 @@ function worktreeHoldingBranch(cwd, branch2) {
|
|
|
23960
24040
|
const listing = gitSyncOrNull(cwd, ["worktree", "list", "--porcelain"]);
|
|
23961
24041
|
if (!listing) return null;
|
|
23962
24042
|
const here = gitSyncOrNull(cwd, ["rev-parse", "--show-toplevel"]);
|
|
23963
|
-
let
|
|
24043
|
+
let path91 = null;
|
|
23964
24044
|
for (const line of listing.split("\n")) {
|
|
23965
24045
|
const trimmed = line.trim();
|
|
23966
24046
|
if (trimmed.startsWith("worktree "))
|
|
23967
|
-
|
|
24047
|
+
path91 = trimmed.slice("worktree ".length).trim();
|
|
23968
24048
|
else if (trimmed === `branch refs/heads/${branch2}`)
|
|
23969
|
-
return
|
|
24049
|
+
return path91 && path91 !== here ? path91 : null;
|
|
23970
24050
|
}
|
|
23971
24051
|
return null;
|
|
23972
24052
|
}
|
|
@@ -24211,7 +24291,7 @@ import chalk175 from "chalk";
|
|
|
24211
24291
|
|
|
24212
24292
|
// src/commands/mermaid/exportFile.ts
|
|
24213
24293
|
import { readFileSync as readFileSync40, writeFileSync as writeFileSync32 } from "fs";
|
|
24214
|
-
import { basename as
|
|
24294
|
+
import { basename as basename18, extname as extname2, resolve as resolve15 } from "path";
|
|
24215
24295
|
import chalk174 from "chalk";
|
|
24216
24296
|
|
|
24217
24297
|
// src/commands/mermaid/renderBlock.ts
|
|
@@ -24238,7 +24318,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
24238
24318
|
async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
24239
24319
|
const content = readFileSync40(file, "utf8");
|
|
24240
24320
|
const blocks = extractMermaidBlocks(content);
|
|
24241
|
-
const stem =
|
|
24321
|
+
const stem = basename18(file, extname2(file));
|
|
24242
24322
|
if (onlyIndex !== void 0) {
|
|
24243
24323
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
24244
24324
|
console.error(
|
|
@@ -25084,9 +25164,9 @@ function parseRscRows(flight) {
|
|
|
25084
25164
|
}
|
|
25085
25165
|
function makeRscResolver(rows) {
|
|
25086
25166
|
return (ref) => {
|
|
25087
|
-
const [id, ...
|
|
25167
|
+
const [id, ...path91] = ref.slice(1).replace(/^[L@]/, "").split(":");
|
|
25088
25168
|
let v = rows[id];
|
|
25089
|
-
for (const key of
|
|
25169
|
+
for (const key of path91) {
|
|
25090
25170
|
if (v == null || typeof v !== "object") return void 0;
|
|
25091
25171
|
v = v[key];
|
|
25092
25172
|
}
|
|
@@ -25706,16 +25786,16 @@ function validateLine(line) {
|
|
|
25706
25786
|
process.exit(1);
|
|
25707
25787
|
}
|
|
25708
25788
|
}
|
|
25709
|
-
async function comment2(
|
|
25789
|
+
async function comment2(path91, line, body, startLine) {
|
|
25710
25790
|
validateBody(body);
|
|
25711
25791
|
validateLine(line);
|
|
25712
25792
|
if (startLine !== void 0) validateLine(startLine);
|
|
25713
25793
|
const range = startLine !== void 0 ? `${startLine}-${line}` : `${line}`;
|
|
25714
|
-
await reviewProposedPrComment(`Comment on ${
|
|
25794
|
+
await reviewProposedPrComment(`Comment on ${path91}:${range}`, body, null);
|
|
25715
25795
|
try {
|
|
25716
25796
|
const prId = getCurrentPrNodeId();
|
|
25717
|
-
postReviewComment({ prId, body, path:
|
|
25718
|
-
console.log(`Added review comment on ${
|
|
25797
|
+
postReviewComment({ prId, body, path: path91, line, startLine });
|
|
25798
|
+
console.log(`Added review comment on ${path91}:${range}`);
|
|
25719
25799
|
} catch (error) {
|
|
25720
25800
|
if (isGhNotInstalled(error)) {
|
|
25721
25801
|
console.error("Error: GitHub CLI (gh) is not installed.");
|
|
@@ -26924,9 +27004,9 @@ function registerPrsComments(prsCommand) {
|
|
|
26924
27004
|
});
|
|
26925
27005
|
prsCommand.command("comment <path> <line> <body>").description(
|
|
26926
27006
|
"Add a line comment to the pending review (body of - reads it from stdin)"
|
|
26927
|
-
).action(async (
|
|
27007
|
+
).action(async (path91, line, body) => {
|
|
26928
27008
|
await comment2(
|
|
26929
|
-
|
|
27009
|
+
path91,
|
|
26930
27010
|
Number.parseInt(line, 10),
|
|
26931
27011
|
await readBodyArgument(body)
|
|
26932
27012
|
);
|
|
@@ -27293,11 +27373,11 @@ async function loadBody(target) {
|
|
|
27293
27373
|
if (target.kind === "file") return readDraftFile(target.path);
|
|
27294
27374
|
return fetchPrBody(target.number, target.repo);
|
|
27295
27375
|
}
|
|
27296
|
-
function readDraftFile(
|
|
27376
|
+
function readDraftFile(path91) {
|
|
27297
27377
|
try {
|
|
27298
|
-
return readFileSync45(
|
|
27378
|
+
return readFileSync45(path91, "utf8");
|
|
27299
27379
|
} catch {
|
|
27300
|
-
console.error(`Error: Could not read \`${
|
|
27380
|
+
console.error(`Error: Could not read \`${path91}\`.`);
|
|
27301
27381
|
console.error(
|
|
27302
27382
|
"Pass a pull request number, a GitHub pull request URL, - for stdin, or a path to a file."
|
|
27303
27383
|
);
|
|
@@ -27576,10 +27656,10 @@ function resolveOpSecret(reference) {
|
|
|
27576
27656
|
}
|
|
27577
27657
|
|
|
27578
27658
|
// src/commands/ravendb/ravenFetch.ts
|
|
27579
|
-
async function ravenFetch(connection,
|
|
27659
|
+
async function ravenFetch(connection, path91) {
|
|
27580
27660
|
const apiKey = resolveOpSecret(connection.apiKeyRef);
|
|
27581
27661
|
let accessToken = await getAccessToken(apiKey);
|
|
27582
|
-
const url = `${connection.url}${
|
|
27662
|
+
const url = `${connection.url}${path91}`;
|
|
27583
27663
|
const headers = {
|
|
27584
27664
|
Authorization: `Bearer ${accessToken}`,
|
|
27585
27665
|
"Content-Type": "application/json"
|
|
@@ -27669,16 +27749,16 @@ import chalk195 from "chalk";
|
|
|
27669
27749
|
// src/commands/ravendb/buildQueryPath.ts
|
|
27670
27750
|
function buildQueryPath(opts) {
|
|
27671
27751
|
const db = encodeURIComponent(opts.db);
|
|
27672
|
-
let
|
|
27752
|
+
let path91;
|
|
27673
27753
|
if (opts.collection) {
|
|
27674
|
-
|
|
27754
|
+
path91 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
|
|
27675
27755
|
} else {
|
|
27676
|
-
|
|
27756
|
+
path91 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
|
|
27677
27757
|
}
|
|
27678
27758
|
if (opts.query) {
|
|
27679
|
-
|
|
27759
|
+
path91 += `&query=${encodeURIComponent(opts.query)}`;
|
|
27680
27760
|
}
|
|
27681
|
-
return
|
|
27761
|
+
return path91;
|
|
27682
27762
|
}
|
|
27683
27763
|
|
|
27684
27764
|
// src/commands/ravendb/fetchAllPages.ts
|
|
@@ -27687,7 +27767,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
27687
27767
|
let start3 = 0;
|
|
27688
27768
|
while (true) {
|
|
27689
27769
|
const effectivePageSize = opts.limit !== void 0 ? Math.min(opts.pageSize, opts.limit - allResults.length) : opts.pageSize;
|
|
27690
|
-
const
|
|
27770
|
+
const path91 = buildQueryPath({
|
|
27691
27771
|
db: connection.database,
|
|
27692
27772
|
collection: opts.collection,
|
|
27693
27773
|
start: start3,
|
|
@@ -27695,7 +27775,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
27695
27775
|
sort: opts.sort,
|
|
27696
27776
|
query: opts.query
|
|
27697
27777
|
});
|
|
27698
|
-
const data = await ravenFetch(connection,
|
|
27778
|
+
const data = await ravenFetch(connection, path91);
|
|
27699
27779
|
const results = data.Results ?? [];
|
|
27700
27780
|
const totalResults = data.TotalResults ?? 0;
|
|
27701
27781
|
if (results.length === 0) break;
|
|
@@ -27753,7 +27833,7 @@ function registerRavendb(program2) {
|
|
|
27753
27833
|
|
|
27754
27834
|
// src/commands/refactor/check/index.ts
|
|
27755
27835
|
import { spawn as spawn6 } from "child_process";
|
|
27756
|
-
import * as
|
|
27836
|
+
import * as path46 from "path";
|
|
27757
27837
|
|
|
27758
27838
|
// src/commands/refactor/logViolations.ts
|
|
27759
27839
|
import chalk197 from "chalk";
|
|
@@ -27930,7 +28010,7 @@ ${failed2.length} verify script(s) failed:`);
|
|
|
27930
28010
|
async function runVerifyQuietly() {
|
|
27931
28011
|
const result = findPackageJsonWithVerifyScripts(process.cwd());
|
|
27932
28012
|
if (!result) return true;
|
|
27933
|
-
const packageDir =
|
|
28013
|
+
const packageDir = path46.dirname(result.packageJsonPath);
|
|
27934
28014
|
const results = await Promise.all(
|
|
27935
28015
|
result.verifyScripts.map((script) => runScript(script, packageDir))
|
|
27936
28016
|
);
|
|
@@ -27956,7 +28036,7 @@ async function check(pattern2, options2) {
|
|
|
27956
28036
|
}
|
|
27957
28037
|
|
|
27958
28038
|
// src/commands/refactor/extract/index.ts
|
|
27959
|
-
import
|
|
28039
|
+
import path54 from "path";
|
|
27960
28040
|
import chalk200 from "chalk";
|
|
27961
28041
|
|
|
27962
28042
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
@@ -28433,9 +28513,9 @@ function buildDestinationContent(functionTexts, imports, sourceRelativePath, sou
|
|
|
28433
28513
|
}
|
|
28434
28514
|
|
|
28435
28515
|
// src/commands/refactor/extract/getRelativeImportPath.ts
|
|
28436
|
-
import
|
|
28516
|
+
import path47 from "path";
|
|
28437
28517
|
function getRelativeImportPath(from, to) {
|
|
28438
|
-
let rel =
|
|
28518
|
+
let rel = path47.relative(path47.dirname(from), to).replace(/\.tsx?$/, "").replace(/\\/g, "/");
|
|
28439
28519
|
if (!rel.startsWith(".")) rel = `./${rel}`;
|
|
28440
28520
|
return rel;
|
|
28441
28521
|
}
|
|
@@ -28459,9 +28539,9 @@ function findImporters(functionName, sourceFile, destPath, project) {
|
|
|
28459
28539
|
}
|
|
28460
28540
|
|
|
28461
28541
|
// src/commands/refactor/extract/resolveBarrel.ts
|
|
28462
|
-
import
|
|
28542
|
+
import path48 from "path";
|
|
28463
28543
|
function resolveBarrel(functionName, sourcePath, destPath, project) {
|
|
28464
|
-
const indexPath =
|
|
28544
|
+
const indexPath = path48.join(path48.dirname(destPath), "index.ts");
|
|
28465
28545
|
const barrel = project.getSourceFile(indexPath);
|
|
28466
28546
|
if (!barrel) return { barrel: void 0, barrelRelPath: "" };
|
|
28467
28547
|
const sourceRelFromBarrel = getRelativeImportPath(indexPath, sourcePath);
|
|
@@ -28479,15 +28559,15 @@ function resolveBarrel(functionName, sourcePath, destPath, project) {
|
|
|
28479
28559
|
}
|
|
28480
28560
|
|
|
28481
28561
|
// src/commands/refactor/extract/rewriteImportPaths.ts
|
|
28482
|
-
import
|
|
28562
|
+
import path49 from "path";
|
|
28483
28563
|
function rewriteImportPaths(imports, sourcePath, destPath) {
|
|
28484
|
-
const sourceDir =
|
|
28485
|
-
const destDir =
|
|
28564
|
+
const sourceDir = path49.dirname(sourcePath);
|
|
28565
|
+
const destDir = path49.dirname(destPath);
|
|
28486
28566
|
return imports.map((imp) => {
|
|
28487
28567
|
if (!imp.moduleSpecifier.startsWith(".")) return imp;
|
|
28488
|
-
const absolute2 =
|
|
28489
|
-
let rel =
|
|
28490
|
-
if (rel === "") rel = `../${
|
|
28568
|
+
const absolute2 = path49.resolve(sourceDir, imp.moduleSpecifier);
|
|
28569
|
+
let rel = path49.relative(destDir, absolute2).replace(/\\/g, "/");
|
|
28570
|
+
if (rel === "") rel = `../${path49.basename(absolute2)}`;
|
|
28491
28571
|
else if (!rel.startsWith(".")) rel = `./${rel}`;
|
|
28492
28572
|
return { ...imp, moduleSpecifier: rel };
|
|
28493
28573
|
});
|
|
@@ -28555,7 +28635,7 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
28555
28635
|
}
|
|
28556
28636
|
|
|
28557
28637
|
// src/commands/refactor/extract/displayPlan.ts
|
|
28558
|
-
import
|
|
28638
|
+
import path50 from "path";
|
|
28559
28639
|
import chalk198 from "chalk";
|
|
28560
28640
|
function section2(title) {
|
|
28561
28641
|
return `
|
|
@@ -28565,7 +28645,7 @@ function displayImporters(plan2, cwd) {
|
|
|
28565
28645
|
if (plan2.importersToUpdate.length === 0) return;
|
|
28566
28646
|
console.log(section2("Update importers:"));
|
|
28567
28647
|
for (const imp of plan2.importersToUpdate) {
|
|
28568
|
-
const rel =
|
|
28648
|
+
const rel = path50.relative(cwd, imp.file.getFilePath());
|
|
28569
28649
|
console.log(` ${chalk198.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
28570
28650
|
}
|
|
28571
28651
|
}
|
|
@@ -28605,17 +28685,17 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
28605
28685
|
}
|
|
28606
28686
|
|
|
28607
28687
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
28608
|
-
import
|
|
28688
|
+
import path53 from "path";
|
|
28609
28689
|
import chalk199 from "chalk";
|
|
28610
28690
|
import { Project as Project4 } from "ts-morph";
|
|
28611
28691
|
|
|
28612
28692
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
28613
28693
|
import fs32 from "fs";
|
|
28614
|
-
import
|
|
28694
|
+
import path52 from "path";
|
|
28615
28695
|
|
|
28616
28696
|
// src/commands/refactor/extract/findEnclosingTsConfig.ts
|
|
28617
28697
|
import fs31 from "fs";
|
|
28618
|
-
import
|
|
28698
|
+
import path51 from "path";
|
|
28619
28699
|
|
|
28620
28700
|
// src/commands/refactor/extract/projectIncludesFile.ts
|
|
28621
28701
|
import { Project as Project3 } from "ts-morph";
|
|
@@ -28630,16 +28710,16 @@ function projectIncludesFile(configPath, sourcePath) {
|
|
|
28630
28710
|
|
|
28631
28711
|
// src/commands/refactor/extract/findEnclosingTsConfig.ts
|
|
28632
28712
|
function findEnclosingTsConfig(sourcePath, rootDir, tried) {
|
|
28633
|
-
let dir =
|
|
28634
|
-
while (dir.startsWith(rootDir +
|
|
28635
|
-
const nested =
|
|
28713
|
+
let dir = path51.dirname(sourcePath);
|
|
28714
|
+
while (dir.startsWith(rootDir + path51.sep) && dir !== rootDir) {
|
|
28715
|
+
const nested = path51.join(dir, "tsconfig.json");
|
|
28636
28716
|
if (!tried.has(nested)) {
|
|
28637
28717
|
tried.add(nested);
|
|
28638
28718
|
if (fs31.existsSync(nested) && projectIncludesFile(nested, sourcePath)) {
|
|
28639
28719
|
return nested;
|
|
28640
28720
|
}
|
|
28641
28721
|
}
|
|
28642
|
-
const parent =
|
|
28722
|
+
const parent = path51.dirname(dir);
|
|
28643
28723
|
if (parent === dir) break;
|
|
28644
28724
|
dir = parent;
|
|
28645
28725
|
}
|
|
@@ -28648,7 +28728,7 @@ function findEnclosingTsConfig(sourcePath, rootDir, tried) {
|
|
|
28648
28728
|
|
|
28649
28729
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
28650
28730
|
function findTsConfig(sourcePath) {
|
|
28651
|
-
const rootConfig =
|
|
28731
|
+
const rootConfig = path52.resolve("tsconfig.json");
|
|
28652
28732
|
if (!fs32.existsSync(rootConfig)) return rootConfig;
|
|
28653
28733
|
const tried = /* @__PURE__ */ new Set();
|
|
28654
28734
|
const candidates = [rootConfig, ...readReferences(rootConfig)];
|
|
@@ -28657,7 +28737,7 @@ function findTsConfig(sourcePath) {
|
|
|
28657
28737
|
tried.add(candidate);
|
|
28658
28738
|
if (projectIncludesFile(candidate, sourcePath)) return candidate;
|
|
28659
28739
|
}
|
|
28660
|
-
const siblings = fs32.readdirSync(
|
|
28740
|
+
const siblings = fs32.readdirSync(path52.dirname(rootConfig)).filter((f) => /^tsconfig.*\.json$/.test(f)).map((f) => path52.resolve(path52.dirname(rootConfig), f));
|
|
28661
28741
|
for (const sibling of siblings) {
|
|
28662
28742
|
if (tried.has(sibling)) continue;
|
|
28663
28743
|
tried.add(sibling);
|
|
@@ -28665,7 +28745,7 @@ function findTsConfig(sourcePath) {
|
|
|
28665
28745
|
}
|
|
28666
28746
|
const nested = findEnclosingTsConfig(
|
|
28667
28747
|
sourcePath,
|
|
28668
|
-
|
|
28748
|
+
path52.dirname(rootConfig),
|
|
28669
28749
|
tried
|
|
28670
28750
|
);
|
|
28671
28751
|
if (nested) return nested;
|
|
@@ -28682,16 +28762,16 @@ function readReferences(configPath) {
|
|
|
28682
28762
|
return [];
|
|
28683
28763
|
}
|
|
28684
28764
|
if (!parsed.references?.length) return [];
|
|
28685
|
-
const cwd =
|
|
28765
|
+
const cwd = path52.dirname(configPath);
|
|
28686
28766
|
return parsed.references.map((ref) => {
|
|
28687
|
-
const refPath =
|
|
28688
|
-
return fs32.statSync(refPath, { throwIfNoEntry: false })?.isDirectory() ?
|
|
28767
|
+
const refPath = path52.resolve(cwd, ref.path);
|
|
28768
|
+
return fs32.statSync(refPath, { throwIfNoEntry: false })?.isDirectory() ? path52.join(refPath, "tsconfig.json") : refPath;
|
|
28689
28769
|
}).filter((p) => fs32.existsSync(p));
|
|
28690
28770
|
}
|
|
28691
28771
|
|
|
28692
28772
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
28693
28773
|
function loadProjectFile(file) {
|
|
28694
|
-
const sourcePath =
|
|
28774
|
+
const sourcePath = path53.resolve(file);
|
|
28695
28775
|
const tsConfigPath = findTsConfig(sourcePath);
|
|
28696
28776
|
const project = new Project4({
|
|
28697
28777
|
tsConfigFilePath: tsConfigPath
|
|
@@ -28706,10 +28786,10 @@ function loadProjectFile(file) {
|
|
|
28706
28786
|
|
|
28707
28787
|
// src/commands/refactor/extract/index.ts
|
|
28708
28788
|
async function extract(file, functionName, destination, options2 = {}) {
|
|
28709
|
-
const sourcePath =
|
|
28710
|
-
const destPath =
|
|
28789
|
+
const sourcePath = path54.resolve(file);
|
|
28790
|
+
const destPath = path54.resolve(destination);
|
|
28711
28791
|
const cwd = process.cwd();
|
|
28712
|
-
const relDest =
|
|
28792
|
+
const relDest = path54.relative(cwd, destPath);
|
|
28713
28793
|
const { project, sourceFile } = loadProjectFile(file);
|
|
28714
28794
|
const plan2 = buildPlan2(
|
|
28715
28795
|
functionName,
|
|
@@ -28757,16 +28837,16 @@ function ignore2(file) {
|
|
|
28757
28837
|
|
|
28758
28838
|
// src/commands/refactor/rename/index.ts
|
|
28759
28839
|
import fs36 from "fs";
|
|
28760
|
-
import
|
|
28840
|
+
import path59 from "path";
|
|
28761
28841
|
import chalk204 from "chalk";
|
|
28762
28842
|
|
|
28763
28843
|
// src/commands/refactor/rename/applyRename.ts
|
|
28764
28844
|
import fs35 from "fs";
|
|
28765
|
-
import
|
|
28845
|
+
import path56 from "path";
|
|
28766
28846
|
import chalk202 from "chalk";
|
|
28767
28847
|
|
|
28768
28848
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
28769
|
-
import
|
|
28849
|
+
import path55 from "path";
|
|
28770
28850
|
|
|
28771
28851
|
// src/commands/refactor/restructure/computeRewrites/applyRewrites.ts
|
|
28772
28852
|
import fs34 from "fs";
|
|
@@ -28820,7 +28900,7 @@ function normalizeSpecifier(rel) {
|
|
|
28820
28900
|
);
|
|
28821
28901
|
}
|
|
28822
28902
|
function computeSpecifier(fromFile, toFile) {
|
|
28823
|
-
return normalizeSpecifier(
|
|
28903
|
+
return normalizeSpecifier(path55.relative(path55.dirname(fromFile), toFile));
|
|
28824
28904
|
}
|
|
28825
28905
|
function isAffected(edge, moveMap) {
|
|
28826
28906
|
return moveMap.has(edge.target) || moveMap.has(edge.source);
|
|
@@ -28868,20 +28948,20 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
28868
28948
|
const updatedContents = applyRewrites(rewrites);
|
|
28869
28949
|
for (const [file, content] of updatedContents) {
|
|
28870
28950
|
fs35.writeFileSync(file, content, "utf8");
|
|
28871
|
-
console.log(chalk202.cyan(` Updated imports in ${
|
|
28951
|
+
console.log(chalk202.cyan(` Updated imports in ${path56.relative(cwd, file)}`));
|
|
28872
28952
|
}
|
|
28873
|
-
const destDir =
|
|
28953
|
+
const destDir = path56.dirname(destPath);
|
|
28874
28954
|
if (!fs35.existsSync(destDir)) fs35.mkdirSync(destDir, { recursive: true });
|
|
28875
28955
|
fs35.renameSync(sourcePath, destPath);
|
|
28876
28956
|
console.log(
|
|
28877
28957
|
chalk202.white(
|
|
28878
|
-
` Moved ${
|
|
28958
|
+
` Moved ${path56.relative(cwd, sourcePath)} \u2192 ${path56.relative(cwd, destPath)}`
|
|
28879
28959
|
)
|
|
28880
28960
|
);
|
|
28881
28961
|
}
|
|
28882
28962
|
|
|
28883
28963
|
// src/commands/refactor/restructure/buildImportGraph/index.ts
|
|
28884
|
-
import
|
|
28964
|
+
import path57 from "path";
|
|
28885
28965
|
import ts7 from "typescript";
|
|
28886
28966
|
|
|
28887
28967
|
// src/commands/refactor/restructure/buildImportGraph/getImportSpecifiers.ts
|
|
@@ -28908,7 +28988,7 @@ function loadParsedConfig(tsConfigPath) {
|
|
|
28908
28988
|
return ts7.parseJsonConfigFileContent(
|
|
28909
28989
|
configFile.config,
|
|
28910
28990
|
ts7.sys,
|
|
28911
|
-
|
|
28991
|
+
path57.dirname(tsConfigPath)
|
|
28912
28992
|
);
|
|
28913
28993
|
}
|
|
28914
28994
|
function addToSetMap(map, key, value) {
|
|
@@ -28924,7 +29004,7 @@ function resolveImport(specifier, filePath, options2) {
|
|
|
28924
29004
|
const resolved = ts7.resolveModuleName(specifier, filePath, options2, ts7.sys);
|
|
28925
29005
|
const resolvedPath = resolved.resolvedModule?.resolvedFileName;
|
|
28926
29006
|
if (!resolvedPath || resolvedPath.includes("node_modules")) return null;
|
|
28927
|
-
return
|
|
29007
|
+
return path57.resolve(resolvedPath);
|
|
28928
29008
|
}
|
|
28929
29009
|
function buildImportGraph(candidateFiles, tsConfigPath) {
|
|
28930
29010
|
const parsed = loadParsedConfig(tsConfigPath);
|
|
@@ -28933,7 +29013,7 @@ function buildImportGraph(candidateFiles, tsConfigPath) {
|
|
|
28933
29013
|
const importedBy = /* @__PURE__ */ new Map();
|
|
28934
29014
|
const imports = /* @__PURE__ */ new Map();
|
|
28935
29015
|
for (const sourceFile of program2.getSourceFiles()) {
|
|
28936
|
-
const filePath =
|
|
29016
|
+
const filePath = path57.resolve(sourceFile.fileName);
|
|
28937
29017
|
if (filePath.includes("node_modules")) continue;
|
|
28938
29018
|
for (const specifier of getImportSpecifiers(sourceFile)) {
|
|
28939
29019
|
const absTarget = resolveImport(specifier, filePath, parsed.options);
|
|
@@ -28960,13 +29040,13 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
28960
29040
|
}
|
|
28961
29041
|
|
|
28962
29042
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
28963
|
-
import
|
|
29043
|
+
import path58 from "path";
|
|
28964
29044
|
import chalk203 from "chalk";
|
|
28965
29045
|
function printRenamePreview(rewrites, cwd) {
|
|
28966
29046
|
for (const rewrite of rewrites) {
|
|
28967
29047
|
console.log(
|
|
28968
29048
|
chalk203.dim(
|
|
28969
|
-
` ${
|
|
29049
|
+
` ${path58.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
28970
29050
|
)
|
|
28971
29051
|
);
|
|
28972
29052
|
}
|
|
@@ -28975,11 +29055,11 @@ function printRenamePreview(rewrites, cwd) {
|
|
|
28975
29055
|
|
|
28976
29056
|
// src/commands/refactor/rename/index.ts
|
|
28977
29057
|
async function rename(source, destination, options2 = {}) {
|
|
28978
|
-
const sourcePath =
|
|
28979
|
-
const destPath =
|
|
29058
|
+
const sourcePath = path59.resolve(source);
|
|
29059
|
+
const destPath = path59.resolve(destination);
|
|
28980
29060
|
const cwd = process.cwd();
|
|
28981
|
-
const relSource =
|
|
28982
|
-
const relDest =
|
|
29061
|
+
const relSource = path59.relative(cwd, sourcePath);
|
|
29062
|
+
const relDest = path59.relative(cwd, destPath);
|
|
28983
29063
|
if (!fs36.existsSync(sourcePath)) {
|
|
28984
29064
|
console.log(chalk204.red(`File not found: ${source}`));
|
|
28985
29065
|
process.exit(1);
|
|
@@ -29034,12 +29114,12 @@ function findSymbol(sourceFile, symbolName) {
|
|
|
29034
29114
|
}
|
|
29035
29115
|
|
|
29036
29116
|
// src/commands/refactor/renameSymbol/groupReferences.ts
|
|
29037
|
-
import
|
|
29117
|
+
import path60 from "path";
|
|
29038
29118
|
function groupReferences(symbol, cwd) {
|
|
29039
29119
|
const refs = symbol.findReferencesAsNodes();
|
|
29040
29120
|
const grouped = /* @__PURE__ */ new Map();
|
|
29041
29121
|
for (const ref of refs) {
|
|
29042
|
-
const refFile =
|
|
29122
|
+
const refFile = path60.relative(cwd, ref.getSourceFile().getFilePath());
|
|
29043
29123
|
const lines2 = grouped.get(refFile) ?? [];
|
|
29044
29124
|
if (!grouped.has(refFile)) grouped.set(refFile, lines2);
|
|
29045
29125
|
lines2.push(ref.getStartLineNumber());
|
|
@@ -29078,16 +29158,16 @@ Renamed ${oldName} \u2192 ${newName}`));
|
|
|
29078
29158
|
}
|
|
29079
29159
|
|
|
29080
29160
|
// src/commands/refactor/restructure/index.ts
|
|
29081
|
-
import
|
|
29161
|
+
import path67 from "path";
|
|
29082
29162
|
import chalk208 from "chalk";
|
|
29083
29163
|
|
|
29084
29164
|
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
29085
|
-
import
|
|
29165
|
+
import path61 from "path";
|
|
29086
29166
|
function clusterDirectories(graph) {
|
|
29087
29167
|
const dirImportedBy = /* @__PURE__ */ new Map();
|
|
29088
29168
|
for (const edge of graph.edges) {
|
|
29089
|
-
const sourceDir =
|
|
29090
|
-
const targetDir =
|
|
29169
|
+
const sourceDir = path61.dirname(edge.source);
|
|
29170
|
+
const targetDir = path61.dirname(edge.target);
|
|
29091
29171
|
if (sourceDir === targetDir) continue;
|
|
29092
29172
|
if (!graph.files.has(edge.target)) continue;
|
|
29093
29173
|
const existing = dirImportedBy.get(targetDir) ?? /* @__PURE__ */ new Set();
|
|
@@ -29115,20 +29195,20 @@ function clusterDirectories(graph) {
|
|
|
29115
29195
|
return clusters;
|
|
29116
29196
|
}
|
|
29117
29197
|
function isAncestor(ancestor, descendant) {
|
|
29118
|
-
const rel =
|
|
29198
|
+
const rel = path61.relative(ancestor, descendant);
|
|
29119
29199
|
return !rel.startsWith("..") && rel !== "";
|
|
29120
29200
|
}
|
|
29121
29201
|
|
|
29122
29202
|
// src/commands/refactor/restructure/clusterFiles.ts
|
|
29123
|
-
import
|
|
29203
|
+
import path62 from "path";
|
|
29124
29204
|
function findRootParent(file, importedBy, visited) {
|
|
29125
29205
|
const importers = importedBy.get(file);
|
|
29126
29206
|
if (!importers || importers.size !== 1) return file;
|
|
29127
29207
|
const parent = [...importers][0];
|
|
29128
|
-
const parentDir =
|
|
29129
|
-
const fileDir =
|
|
29208
|
+
const parentDir = path62.dirname(parent);
|
|
29209
|
+
const fileDir = path62.dirname(file);
|
|
29130
29210
|
if (parentDir !== fileDir) return file;
|
|
29131
|
-
if (
|
|
29211
|
+
if (path62.basename(parent, path62.extname(parent)) === "index") return file;
|
|
29132
29212
|
if (visited.has(parent)) return file;
|
|
29133
29213
|
visited.add(parent);
|
|
29134
29214
|
return findRootParent(parent, importedBy, visited);
|
|
@@ -29136,16 +29216,16 @@ function findRootParent(file, importedBy, visited) {
|
|
|
29136
29216
|
function clusterFiles(graph) {
|
|
29137
29217
|
const clusters = /* @__PURE__ */ new Map();
|
|
29138
29218
|
for (const file of graph.files) {
|
|
29139
|
-
const
|
|
29140
|
-
if (
|
|
29219
|
+
const basename28 = path62.basename(file, path62.extname(file));
|
|
29220
|
+
if (basename28 === "index") continue;
|
|
29141
29221
|
const importers = graph.importedBy.get(file);
|
|
29142
29222
|
if (!importers || importers.size !== 1) continue;
|
|
29143
29223
|
const parent = [...importers][0];
|
|
29144
29224
|
if (!graph.files.has(parent)) continue;
|
|
29145
|
-
const parentDir =
|
|
29146
|
-
const fileDir =
|
|
29225
|
+
const parentDir = path62.dirname(parent);
|
|
29226
|
+
const fileDir = path62.dirname(file);
|
|
29147
29227
|
if (parentDir !== fileDir) continue;
|
|
29148
|
-
const parentBasename =
|
|
29228
|
+
const parentBasename = path62.basename(parent, path62.extname(parent));
|
|
29149
29229
|
if (parentBasename === "index") continue;
|
|
29150
29230
|
const root = findRootParent(parent, graph.importedBy, /* @__PURE__ */ new Set([file]));
|
|
29151
29231
|
if (!root || root === file) continue;
|
|
@@ -29157,10 +29237,10 @@ function clusterFiles(graph) {
|
|
|
29157
29237
|
}
|
|
29158
29238
|
|
|
29159
29239
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
29160
|
-
import
|
|
29240
|
+
import path63 from "path";
|
|
29161
29241
|
import chalk206 from "chalk";
|
|
29162
29242
|
function relPath(filePath) {
|
|
29163
|
-
return
|
|
29243
|
+
return path63.relative(process.cwd(), filePath);
|
|
29164
29244
|
}
|
|
29165
29245
|
function displayMoves(plan2) {
|
|
29166
29246
|
if (plan2.moves.length === 0) return;
|
|
@@ -29210,33 +29290,33 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
29210
29290
|
|
|
29211
29291
|
// src/commands/refactor/restructure/executePlan.ts
|
|
29212
29292
|
import fs37 from "fs";
|
|
29213
|
-
import
|
|
29293
|
+
import path64 from "path";
|
|
29214
29294
|
import chalk207 from "chalk";
|
|
29215
29295
|
function executePlan(plan2) {
|
|
29216
29296
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
29217
29297
|
for (const [file, content] of updatedContents) {
|
|
29218
29298
|
fs37.writeFileSync(file, content, "utf8");
|
|
29219
29299
|
console.log(
|
|
29220
|
-
chalk207.cyan(` Rewrote imports in ${
|
|
29300
|
+
chalk207.cyan(` Rewrote imports in ${path64.relative(process.cwd(), file)}`)
|
|
29221
29301
|
);
|
|
29222
29302
|
}
|
|
29223
29303
|
for (const dir of plan2.newDirectories) {
|
|
29224
29304
|
fs37.mkdirSync(dir, { recursive: true });
|
|
29225
|
-
console.log(chalk207.green(` Created ${
|
|
29305
|
+
console.log(chalk207.green(` Created ${path64.relative(process.cwd(), dir)}/`));
|
|
29226
29306
|
}
|
|
29227
29307
|
for (const move2 of plan2.moves) {
|
|
29228
|
-
const targetDir =
|
|
29308
|
+
const targetDir = path64.dirname(move2.to);
|
|
29229
29309
|
if (!fs37.existsSync(targetDir)) {
|
|
29230
29310
|
fs37.mkdirSync(targetDir, { recursive: true });
|
|
29231
29311
|
}
|
|
29232
29312
|
fs37.renameSync(move2.from, move2.to);
|
|
29233
29313
|
console.log(
|
|
29234
29314
|
chalk207.white(
|
|
29235
|
-
` Moved ${
|
|
29315
|
+
` Moved ${path64.relative(process.cwd(), move2.from)} \u2192 ${path64.relative(process.cwd(), move2.to)}`
|
|
29236
29316
|
)
|
|
29237
29317
|
);
|
|
29238
29318
|
}
|
|
29239
|
-
removeEmptyDirectories(plan2.moves.map((m) =>
|
|
29319
|
+
removeEmptyDirectories(plan2.moves.map((m) => path64.dirname(m.from)));
|
|
29240
29320
|
}
|
|
29241
29321
|
function removeEmptyDirectories(dirs) {
|
|
29242
29322
|
const unique = [...new Set(dirs)];
|
|
@@ -29247,7 +29327,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
29247
29327
|
fs37.rmdirSync(dir);
|
|
29248
29328
|
console.log(
|
|
29249
29329
|
chalk207.dim(
|
|
29250
|
-
` Removed empty directory ${
|
|
29330
|
+
` Removed empty directory ${path64.relative(process.cwd(), dir)}`
|
|
29251
29331
|
)
|
|
29252
29332
|
);
|
|
29253
29333
|
}
|
|
@@ -29255,7 +29335,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
29255
29335
|
}
|
|
29256
29336
|
|
|
29257
29337
|
// src/commands/refactor/restructure/planFileMoves/index.ts
|
|
29258
|
-
import
|
|
29338
|
+
import path66 from "path";
|
|
29259
29339
|
|
|
29260
29340
|
// src/commands/refactor/restructure/planFileMoves/shared.ts
|
|
29261
29341
|
import fs38 from "fs";
|
|
@@ -29270,9 +29350,9 @@ function checkDirConflict(result, label2, dir) {
|
|
|
29270
29350
|
|
|
29271
29351
|
// src/commands/refactor/restructure/planFileMoves/planDirectoryMoves.ts
|
|
29272
29352
|
import fs39 from "fs";
|
|
29273
|
-
import
|
|
29353
|
+
import path65 from "path";
|
|
29274
29354
|
function collectEntry2(results, dir, entry) {
|
|
29275
|
-
const full =
|
|
29355
|
+
const full = path65.join(dir, entry.name);
|
|
29276
29356
|
const items2 = entry.isDirectory() ? listFilesRecursive(full) : [full];
|
|
29277
29357
|
results.push(...items2);
|
|
29278
29358
|
}
|
|
@@ -29286,15 +29366,15 @@ function listFilesRecursive(dir) {
|
|
|
29286
29366
|
}
|
|
29287
29367
|
function addDirectoryFileMoves(moves, childDir, newLocation, reason4) {
|
|
29288
29368
|
for (const file of listFilesRecursive(childDir)) {
|
|
29289
|
-
const rel =
|
|
29290
|
-
moves.push({ from: file, to:
|
|
29369
|
+
const rel = path65.relative(childDir, file);
|
|
29370
|
+
moves.push({ from: file, to: path65.join(newLocation, rel), reason: reason4 });
|
|
29291
29371
|
}
|
|
29292
29372
|
}
|
|
29293
29373
|
function resolveChildDest(parentDir, childDir) {
|
|
29294
|
-
return
|
|
29374
|
+
return path65.join(parentDir, path65.basename(childDir));
|
|
29295
29375
|
}
|
|
29296
29376
|
function childMoveReason(parentDir) {
|
|
29297
|
-
return `Directory only imported from ${
|
|
29377
|
+
return `Directory only imported from ${path65.basename(parentDir)}/`;
|
|
29298
29378
|
}
|
|
29299
29379
|
function registerDirectoryMove(result, childDir, dest, parentDir) {
|
|
29300
29380
|
result.directories.push(dest);
|
|
@@ -29319,7 +29399,7 @@ function planDirectoryMoves(clusters) {
|
|
|
29319
29399
|
|
|
29320
29400
|
// src/commands/refactor/restructure/planFileMoves/index.ts
|
|
29321
29401
|
function childMoveData(child, newDir, parentBase) {
|
|
29322
|
-
const to =
|
|
29402
|
+
const to = path66.join(newDir, path66.basename(child));
|
|
29323
29403
|
return { from: child, to, reason: `Only imported by ${parentBase}` };
|
|
29324
29404
|
}
|
|
29325
29405
|
function addChildMoves(moves, children, newDir, parentBase) {
|
|
@@ -29327,15 +29407,15 @@ function addChildMoves(moves, children, newDir, parentBase) {
|
|
|
29327
29407
|
moves.push(childMoveData(child, newDir, parentBase));
|
|
29328
29408
|
}
|
|
29329
29409
|
function getBaseName(filePath) {
|
|
29330
|
-
return
|
|
29410
|
+
return path66.basename(filePath, path66.extname(filePath));
|
|
29331
29411
|
}
|
|
29332
29412
|
function resolveClusterDir(parent) {
|
|
29333
|
-
return
|
|
29413
|
+
return path66.join(path66.dirname(parent), getBaseName(parent));
|
|
29334
29414
|
}
|
|
29335
29415
|
function createParentMove(parent, newDir) {
|
|
29336
29416
|
return {
|
|
29337
29417
|
from: parent,
|
|
29338
|
-
to:
|
|
29418
|
+
to: path66.join(newDir, `index${path66.extname(parent)}`),
|
|
29339
29419
|
reason: `Main module of new ${getBaseName(parent)}/ directory`
|
|
29340
29420
|
};
|
|
29341
29421
|
}
|
|
@@ -29359,7 +29439,7 @@ function planFileMoves(clusters) {
|
|
|
29359
29439
|
|
|
29360
29440
|
// src/commands/refactor/restructure/index.ts
|
|
29361
29441
|
function buildPlan3(candidateFiles, tsConfigPath) {
|
|
29362
|
-
const candidates = new Set(candidateFiles.map((f) =>
|
|
29442
|
+
const candidates = new Set(candidateFiles.map((f) => path67.resolve(f)));
|
|
29363
29443
|
const graph = buildImportGraph(candidates, tsConfigPath);
|
|
29364
29444
|
const allProjectFiles = /* @__PURE__ */ new Set([
|
|
29365
29445
|
...graph.importedBy.keys(),
|
|
@@ -29382,7 +29462,7 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
29382
29462
|
console.log(chalk208.yellow("No files found matching pattern"));
|
|
29383
29463
|
return;
|
|
29384
29464
|
}
|
|
29385
|
-
const tsConfigPath = findTsConfig(
|
|
29465
|
+
const tsConfigPath = findTsConfig(path67.resolve(files[0]));
|
|
29386
29466
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
29387
29467
|
if (plan2.moves.length === 0) {
|
|
29388
29468
|
console.log(chalk208.green("No restructuring needed"));
|
|
@@ -29561,13 +29641,13 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
29561
29641
|
|
|
29562
29642
|
// src/commands/review/buildReviewPaths.ts
|
|
29563
29643
|
import { homedir as homedir23 } from "os";
|
|
29564
|
-
import { basename as
|
|
29644
|
+
import { basename as basename19, join as join72 } from "path";
|
|
29565
29645
|
function buildReviewPaths(repoRoot2, key) {
|
|
29566
29646
|
const reviewDir = join72(
|
|
29567
29647
|
homedir23(),
|
|
29568
29648
|
".assist",
|
|
29569
29649
|
"reviews",
|
|
29570
|
-
|
|
29650
|
+
basename19(repoRoot2),
|
|
29571
29651
|
key
|
|
29572
29652
|
);
|
|
29573
29653
|
return {
|
|
@@ -30303,8 +30383,8 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
|
|
|
30303
30383
|
// src/commands/review/prepareReviewDir.ts
|
|
30304
30384
|
import { existsSync as existsSync61, mkdirSync as mkdirSync21, unlinkSync as unlinkSync17, writeFileSync as writeFileSync38 } from "fs";
|
|
30305
30385
|
function clearReviewFiles(paths) {
|
|
30306
|
-
for (const
|
|
30307
|
-
if (existsSync61(
|
|
30386
|
+
for (const path91 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
30387
|
+
if (existsSync61(path91)) unlinkSync17(path91);
|
|
30308
30388
|
}
|
|
30309
30389
|
}
|
|
30310
30390
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -31414,7 +31494,7 @@ function registerReview(program2) {
|
|
|
31414
31494
|
|
|
31415
31495
|
// src/commands/rules/addRule.ts
|
|
31416
31496
|
import { existsSync as existsSync66, readFileSync as readFileSync51, writeFileSync as writeFileSync41 } from "fs";
|
|
31417
|
-
import
|
|
31497
|
+
import path72 from "path";
|
|
31418
31498
|
import chalk211 from "chalk";
|
|
31419
31499
|
|
|
31420
31500
|
// src/commands/rules/insertRuleBullet.ts
|
|
@@ -31442,7 +31522,7 @@ import { readFileSync as readFileSync48 } from "fs";
|
|
|
31442
31522
|
|
|
31443
31523
|
// src/commands/rules/findClaudeFiles.ts
|
|
31444
31524
|
import { readdirSync as readdirSync13 } from "fs";
|
|
31445
|
-
import
|
|
31525
|
+
import path68 from "path";
|
|
31446
31526
|
var SKIP_DIRECTORIES = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage"]);
|
|
31447
31527
|
function findClaudeFiles(dir) {
|
|
31448
31528
|
const results = [];
|
|
@@ -31450,9 +31530,9 @@ function findClaudeFiles(dir) {
|
|
|
31450
31530
|
if (entry.isDirectory()) {
|
|
31451
31531
|
if (entry.name.startsWith(".") || SKIP_DIRECTORIES.has(entry.name))
|
|
31452
31532
|
continue;
|
|
31453
|
-
results.push(...findClaudeFiles(
|
|
31533
|
+
results.push(...findClaudeFiles(path68.join(dir, entry.name)));
|
|
31454
31534
|
} else if (entry.name === "CLAUDE.md") {
|
|
31455
|
-
results.push(
|
|
31535
|
+
results.push(path68.join(dir, entry.name));
|
|
31456
31536
|
}
|
|
31457
31537
|
}
|
|
31458
31538
|
return results;
|
|
@@ -31471,34 +31551,34 @@ function nextRuleCode(root) {
|
|
|
31471
31551
|
|
|
31472
31552
|
// src/commands/rules/resolveRuleScope.ts
|
|
31473
31553
|
import { existsSync as existsSync64 } from "fs";
|
|
31474
|
-
import
|
|
31554
|
+
import path69 from "path";
|
|
31475
31555
|
function resolveRuleScope(target) {
|
|
31476
|
-
const resolved =
|
|
31477
|
-
if (
|
|
31556
|
+
const resolved = path69.resolve(target);
|
|
31557
|
+
if (path69.basename(resolved) === "CLAUDE.md") return resolved;
|
|
31478
31558
|
const startDir = scopeDirectory(resolved);
|
|
31479
31559
|
const root = findRepoRoot(startDir) ?? startDir;
|
|
31480
31560
|
let current = startDir;
|
|
31481
31561
|
while (true) {
|
|
31482
|
-
const candidate =
|
|
31562
|
+
const candidate = path69.join(current, "CLAUDE.md");
|
|
31483
31563
|
if (existsSync64(candidate)) return candidate;
|
|
31484
|
-
if (current === root || current ===
|
|
31485
|
-
current =
|
|
31564
|
+
if (current === root || current === path69.dirname(current)) break;
|
|
31565
|
+
current = path69.dirname(current);
|
|
31486
31566
|
}
|
|
31487
|
-
return
|
|
31567
|
+
return path69.join(root, "CLAUDE.md");
|
|
31488
31568
|
}
|
|
31489
31569
|
|
|
31490
31570
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
31491
31571
|
import { existsSync as existsSync65, readFileSync as readFileSync50, writeFileSync as writeFileSync40 } from "fs";
|
|
31492
|
-
import
|
|
31572
|
+
import path71 from "path";
|
|
31493
31573
|
|
|
31494
31574
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
31495
31575
|
import { readFileSync as readFileSync49 } from "fs";
|
|
31496
|
-
import
|
|
31576
|
+
import path70 from "path";
|
|
31497
31577
|
function scopedRuleDirectories(root) {
|
|
31498
31578
|
return findClaudeFiles(root).filter(
|
|
31499
|
-
(file) =>
|
|
31579
|
+
(file) => path70.dirname(file) !== root && parseRulesSection(readFileSync49(file, "utf8")).length > 0
|
|
31500
31580
|
).map(
|
|
31501
|
-
(file) => `${
|
|
31581
|
+
(file) => `${path70.relative(root, path70.dirname(file)).split(path70.sep).join("/")}/`
|
|
31502
31582
|
).sort();
|
|
31503
31583
|
}
|
|
31504
31584
|
|
|
@@ -31537,7 +31617,7 @@ function upsertScopedRulesPointer(content, directories) {
|
|
|
31537
31617
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
31538
31618
|
function updateScopedRulesIndex(root) {
|
|
31539
31619
|
const directories = scopedRuleDirectories(root);
|
|
31540
|
-
const rootFile =
|
|
31620
|
+
const rootFile = path71.join(root, "CLAUDE.md");
|
|
31541
31621
|
const before = existsSync65(rootFile) ? readFileSync50(rootFile, "utf8") : "";
|
|
31542
31622
|
const after = upsertScopedRulesPointer(before, directories);
|
|
31543
31623
|
if (after !== before) writeFileSync40(rootFile, after);
|
|
@@ -31556,7 +31636,7 @@ function addRule(text18, options2) {
|
|
|
31556
31636
|
return;
|
|
31557
31637
|
}
|
|
31558
31638
|
const target = resolveRuleScope(options2.scope ?? process.cwd());
|
|
31559
|
-
const targetDir =
|
|
31639
|
+
const targetDir = path72.dirname(target);
|
|
31560
31640
|
const root = findRepoRoot(targetDir) ?? targetDir;
|
|
31561
31641
|
const code = nextRuleCode(root);
|
|
31562
31642
|
writeFileSync41(
|
|
@@ -31569,18 +31649,18 @@ function addRule(text18, options2) {
|
|
|
31569
31649
|
);
|
|
31570
31650
|
updateScopedRulesIndex(root);
|
|
31571
31651
|
console.log(
|
|
31572
|
-
`Added ${chalk211.cyan(code)} to ${
|
|
31652
|
+
`Added ${chalk211.cyan(code)} to ${path72.relative(process.cwd(), target) || target}`
|
|
31573
31653
|
);
|
|
31574
31654
|
}
|
|
31575
31655
|
|
|
31576
31656
|
// src/commands/rules/indexRules.ts
|
|
31577
|
-
import
|
|
31657
|
+
import path73 from "path";
|
|
31578
31658
|
import chalk212 from "chalk";
|
|
31579
31659
|
function indexRules() {
|
|
31580
31660
|
const startDir = scopeDirectory(process.cwd());
|
|
31581
31661
|
const root = findRepoRoot(startDir) ?? startDir;
|
|
31582
31662
|
const directories = updateScopedRulesIndex(root);
|
|
31583
|
-
const rootFile =
|
|
31663
|
+
const rootFile = path73.relative(process.cwd(), path73.join(root, "CLAUDE.md"));
|
|
31584
31664
|
if (directories.length === 0) {
|
|
31585
31665
|
console.log(
|
|
31586
31666
|
chalk212.gray(`No directories carry their own \`## Rules\` under ${root}`)
|
|
@@ -31593,13 +31673,13 @@ function indexRules() {
|
|
|
31593
31673
|
}
|
|
31594
31674
|
|
|
31595
31675
|
// src/commands/rules/listRules.ts
|
|
31596
|
-
import
|
|
31676
|
+
import path74 from "path";
|
|
31597
31677
|
import chalk213 from "chalk";
|
|
31598
31678
|
function listRules(target, options2 = {}) {
|
|
31599
|
-
const resolved =
|
|
31679
|
+
const resolved = path74.resolve(target ?? process.cwd());
|
|
31600
31680
|
const rules3 = readScopedRules(resolved);
|
|
31601
31681
|
if (rules3.length === 0) {
|
|
31602
|
-
const label2 =
|
|
31682
|
+
const label2 = path74.relative(process.cwd(), resolved) || ".";
|
|
31603
31683
|
console.log(chalk213.gray(`No rules in scope for ${label2}`));
|
|
31604
31684
|
return;
|
|
31605
31685
|
}
|
|
@@ -31610,7 +31690,7 @@ function listRules(target, options2 = {}) {
|
|
|
31610
31690
|
if (rule.source !== shown) {
|
|
31611
31691
|
shown = rule.source;
|
|
31612
31692
|
console.log(
|
|
31613
|
-
chalk213.dim(base ?
|
|
31693
|
+
chalk213.dim(base ? path74.relative(base, rule.source) : rule.source)
|
|
31614
31694
|
);
|
|
31615
31695
|
}
|
|
31616
31696
|
console.log(
|
|
@@ -31706,8 +31786,8 @@ import chalk219 from "chalk";
|
|
|
31706
31786
|
|
|
31707
31787
|
// src/commands/seq/fetchSeq.ts
|
|
31708
31788
|
import chalk216 from "chalk";
|
|
31709
|
-
async function fetchSeq(conn,
|
|
31710
|
-
const url = `${conn.url}${
|
|
31789
|
+
async function fetchSeq(conn, path91, params) {
|
|
31790
|
+
const url = `${conn.url}${path91}?${params}`;
|
|
31711
31791
|
const response = await fetch(url, {
|
|
31712
31792
|
headers: {
|
|
31713
31793
|
Accept: "application/json",
|
|
@@ -32359,15 +32439,15 @@ function registerSql(program2) {
|
|
|
32359
32439
|
// src/commands/sync.ts
|
|
32360
32440
|
import * as fs48 from "fs";
|
|
32361
32441
|
import * as os5 from "os";
|
|
32362
|
-
import * as
|
|
32442
|
+
import * as path85 from "path";
|
|
32363
32443
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
32364
32444
|
|
|
32365
32445
|
// src/commands/sync/pruneCommands.ts
|
|
32366
|
-
import * as
|
|
32446
|
+
import * as path76 from "path";
|
|
32367
32447
|
|
|
32368
32448
|
// src/commands/sync/pruneTarget.ts
|
|
32369
32449
|
import * as fs40 from "fs";
|
|
32370
|
-
import * as
|
|
32450
|
+
import * as path75 from "path";
|
|
32371
32451
|
function pruneTarget(targetDir, keepNames, shape, options2) {
|
|
32372
32452
|
const result = {
|
|
32373
32453
|
orphans: [],
|
|
@@ -32385,7 +32465,7 @@ function pruneTarget(targetDir, keepNames, shape, options2) {
|
|
|
32385
32465
|
}
|
|
32386
32466
|
if (keep.has(name)) continue;
|
|
32387
32467
|
result.orphans.push(entry.name);
|
|
32388
|
-
const entryPath =
|
|
32468
|
+
const entryPath = path75.join(targetDir, entry.name);
|
|
32389
32469
|
const reason4 = shape.blockedBy?.(entryPath);
|
|
32390
32470
|
if (reason4) {
|
|
32391
32471
|
result.skipped.push({ name: entry.name, reason: reason4 });
|
|
@@ -32405,7 +32485,7 @@ function pruneCommands(targetDir, commandNames, options2) {
|
|
|
32405
32485
|
targetDir,
|
|
32406
32486
|
commandNames,
|
|
32407
32487
|
{
|
|
32408
|
-
nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ?
|
|
32488
|
+
nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ? path76.basename(entry.name, ".md") : void 0
|
|
32409
32489
|
},
|
|
32410
32490
|
options2
|
|
32411
32491
|
);
|
|
@@ -32440,11 +32520,11 @@ function reportPrune(label2, result, force) {
|
|
|
32440
32520
|
|
|
32441
32521
|
// src/commands/sync/syncClaudeMd.ts
|
|
32442
32522
|
import * as fs41 from "fs";
|
|
32443
|
-
import * as
|
|
32523
|
+
import * as path77 from "path";
|
|
32444
32524
|
import chalk226 from "chalk";
|
|
32445
32525
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
32446
|
-
const source =
|
|
32447
|
-
const target =
|
|
32526
|
+
const source = path77.join(claudeDir, "CLAUDE.md");
|
|
32527
|
+
const target = path77.join(targetBase, "CLAUDE.md");
|
|
32448
32528
|
const sourceContent = fs41.readFileSync(source, "utf8");
|
|
32449
32529
|
if (fs41.existsSync(target)) {
|
|
32450
32530
|
const targetContent = fs41.readFileSync(target, "utf8");
|
|
@@ -32472,13 +32552,13 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
32472
32552
|
}
|
|
32473
32553
|
|
|
32474
32554
|
// src/commands/sync/syncCodex.ts
|
|
32475
|
-
import * as
|
|
32555
|
+
import * as path80 from "path";
|
|
32476
32556
|
|
|
32477
32557
|
// src/commands/sync/installHarnessCommands.ts
|
|
32478
32558
|
import * as fs42 from "fs";
|
|
32479
|
-
import * as
|
|
32559
|
+
import * as path78 from "path";
|
|
32480
32560
|
function installHarnessCommands(claudeDir, harness, transform) {
|
|
32481
|
-
const commandsSource =
|
|
32561
|
+
const commandsSource = path78.join(claudeDir, "commands");
|
|
32482
32562
|
const files = fs42.readdirSync(commandsSource);
|
|
32483
32563
|
const names = [];
|
|
32484
32564
|
let synced = 0;
|
|
@@ -32486,15 +32566,15 @@ function installHarnessCommands(claudeDir, harness, transform) {
|
|
|
32486
32566
|
if (!file.endsWith(".md")) continue;
|
|
32487
32567
|
const name = file.replace(/\.md$/, "");
|
|
32488
32568
|
names.push(name);
|
|
32489
|
-
const content = fs42.readFileSync(
|
|
32490
|
-
const target =
|
|
32491
|
-
fs42.mkdirSync(
|
|
32569
|
+
const content = fs42.readFileSync(path78.join(commandsSource, file), "utf8");
|
|
32570
|
+
const target = path78.join(harness.homeDir, harness.sync.commandDest(name));
|
|
32571
|
+
fs42.mkdirSync(path78.dirname(target), { recursive: true });
|
|
32492
32572
|
fs42.writeFileSync(target, transform(name, content));
|
|
32493
32573
|
synced++;
|
|
32494
32574
|
}
|
|
32495
|
-
const agentsTarget =
|
|
32496
|
-
fs42.mkdirSync(
|
|
32497
|
-
fs42.copyFileSync(
|
|
32575
|
+
const agentsTarget = path78.join(harness.homeDir, harness.sync.agentsFile);
|
|
32576
|
+
fs42.mkdirSync(path78.dirname(agentsTarget), { recursive: true });
|
|
32577
|
+
fs42.copyFileSync(path78.join(claudeDir, "CLAUDE.md"), agentsTarget);
|
|
32498
32578
|
return { total: files.length, synced, names };
|
|
32499
32579
|
}
|
|
32500
32580
|
|
|
@@ -32520,7 +32600,7 @@ function unexpectedContent(skillDir) {
|
|
|
32520
32600
|
|
|
32521
32601
|
// src/commands/sync/syncCodexHooks.ts
|
|
32522
32602
|
import * as fs44 from "fs";
|
|
32523
|
-
import * as
|
|
32603
|
+
import * as path79 from "path";
|
|
32524
32604
|
var BEGIN = "# >>> assist codex hooks (managed) \u2014 do not edit >>>";
|
|
32525
32605
|
var END = "# <<< assist codex hooks (managed) <<<";
|
|
32526
32606
|
function upsertManagedBlock(existing, body) {
|
|
@@ -32551,9 +32631,9 @@ ${rest}
|
|
|
32551
32631
|
}
|
|
32552
32632
|
function syncCodexHooks(sourcePath) {
|
|
32553
32633
|
const body = fs44.readFileSync(sourcePath, "utf8");
|
|
32554
|
-
const configPath =
|
|
32634
|
+
const configPath = path79.join(harnesses.codex.homeDir, "config.toml");
|
|
32555
32635
|
const existing = fs44.existsSync(configPath) ? fs44.readFileSync(configPath, "utf8") : "";
|
|
32556
|
-
fs44.mkdirSync(
|
|
32636
|
+
fs44.mkdirSync(path79.dirname(configPath), { recursive: true });
|
|
32557
32637
|
fs44.writeFileSync(configPath, upsertManagedBlock(existing, body));
|
|
32558
32638
|
console.log(
|
|
32559
32639
|
"Registered assist codex-hook in ~/.codex/config.toml (UserPromptSubmit, PreToolUse, PostToolUse, PermissionRequest, Stop)"
|
|
@@ -32585,7 +32665,7 @@ function syncCodex(claudeDir, options2) {
|
|
|
32585
32665
|
harnesses.codex,
|
|
32586
32666
|
commandToSkill
|
|
32587
32667
|
);
|
|
32588
|
-
syncCodexHooks(
|
|
32668
|
+
syncCodexHooks(path80.join(claudeDir, "..", "codex", "config.toml"));
|
|
32589
32669
|
console.log(
|
|
32590
32670
|
`Synced ${total} skill(s) to ~/.codex/skills and CLAUDE.md to ~/.codex/AGENTS.md`
|
|
32591
32671
|
);
|
|
@@ -32593,42 +32673,42 @@ function syncCodex(claudeDir, options2) {
|
|
|
32593
32673
|
const force = options2.force ?? false;
|
|
32594
32674
|
reportPrune(
|
|
32595
32675
|
"~/.codex/skills",
|
|
32596
|
-
pruneSkills(
|
|
32676
|
+
pruneSkills(path80.join(harnesses.codex.homeDir, "skills"), names, { force }),
|
|
32597
32677
|
force
|
|
32598
32678
|
);
|
|
32599
32679
|
}
|
|
32600
32680
|
|
|
32601
32681
|
// src/commands/sync/syncDesign.ts
|
|
32602
32682
|
import * as fs45 from "fs";
|
|
32603
|
-
import * as
|
|
32683
|
+
import * as path81 from "path";
|
|
32604
32684
|
function syncDesign(claudeDir, targetBase) {
|
|
32605
|
-
const systemPromptSource =
|
|
32606
|
-
const systemPromptTarget =
|
|
32685
|
+
const systemPromptSource = path81.join(claudeDir, "design-system-prompt.md");
|
|
32686
|
+
const systemPromptTarget = path81.join(targetBase, "design-system-prompt.md");
|
|
32607
32687
|
fs45.copyFileSync(systemPromptSource, systemPromptTarget);
|
|
32608
32688
|
console.log(
|
|
32609
32689
|
"Copied design-system-prompt.md to ~/.claude/design-system-prompt.md"
|
|
32610
32690
|
);
|
|
32611
|
-
const skillsSource =
|
|
32612
|
-
const skillsTarget =
|
|
32691
|
+
const skillsSource = path81.join(claudeDir, "skills");
|
|
32692
|
+
const skillsTarget = path81.join(targetBase, "skills");
|
|
32613
32693
|
fs45.mkdirSync(skillsTarget, { recursive: true });
|
|
32614
32694
|
const files = fs45.readdirSync(skillsSource);
|
|
32615
32695
|
for (const file of files) {
|
|
32616
32696
|
fs45.copyFileSync(
|
|
32617
|
-
|
|
32618
|
-
|
|
32697
|
+
path81.join(skillsSource, file),
|
|
32698
|
+
path81.join(skillsTarget, file)
|
|
32619
32699
|
);
|
|
32620
32700
|
}
|
|
32621
32701
|
console.log(`Synced ${files.length} design skill(s) to ~/.claude/skills`);
|
|
32622
32702
|
}
|
|
32623
32703
|
|
|
32624
32704
|
// src/commands/sync/syncPi.ts
|
|
32625
|
-
import * as
|
|
32705
|
+
import * as path83 from "path";
|
|
32626
32706
|
|
|
32627
32707
|
// src/commands/sync/syncPiHooks.ts
|
|
32628
32708
|
import * as fs46 from "fs";
|
|
32629
|
-
import * as
|
|
32709
|
+
import * as path82 from "path";
|
|
32630
32710
|
function piExtensionsDir() {
|
|
32631
|
-
return
|
|
32711
|
+
return path82.join(harnesses.pi.homeDir, "extensions");
|
|
32632
32712
|
}
|
|
32633
32713
|
function syncPiHooks(sourceDir) {
|
|
32634
32714
|
const target = piExtensionsDir();
|
|
@@ -32636,8 +32716,8 @@ function syncPiHooks(sourceDir) {
|
|
|
32636
32716
|
const files = fs46.readdirSync(sourceDir).filter((f) => f.endsWith(".ts"));
|
|
32637
32717
|
for (const file of files) {
|
|
32638
32718
|
fs46.copyFileSync(
|
|
32639
|
-
|
|
32640
|
-
|
|
32719
|
+
path82.join(sourceDir, file),
|
|
32720
|
+
path82.join(target, `assist-${file}`)
|
|
32641
32721
|
);
|
|
32642
32722
|
}
|
|
32643
32723
|
console.log(
|
|
@@ -32674,7 +32754,7 @@ function syncPi(claudeDir, options2) {
|
|
|
32674
32754
|
harnesses.pi,
|
|
32675
32755
|
commandToPrompt
|
|
32676
32756
|
);
|
|
32677
|
-
syncPiHooks(
|
|
32757
|
+
syncPiHooks(path83.join(claudeDir, "..", "pi"));
|
|
32678
32758
|
console.log(
|
|
32679
32759
|
`Synced ${synced} prompt(s) to ~/.pi/agent/prompts and CLAUDE.md to ~/.pi/agent/AGENTS.md`
|
|
32680
32760
|
);
|
|
@@ -32682,18 +32762,18 @@ function syncPi(claudeDir, options2) {
|
|
|
32682
32762
|
const force = options2.force ?? false;
|
|
32683
32763
|
reportPrune(
|
|
32684
32764
|
"~/.pi/agent/prompts",
|
|
32685
|
-
pruneCommands(
|
|
32765
|
+
pruneCommands(path83.join(harnesses.pi.homeDir, "prompts"), names, { force }),
|
|
32686
32766
|
force
|
|
32687
32767
|
);
|
|
32688
32768
|
}
|
|
32689
32769
|
|
|
32690
32770
|
// src/commands/sync/syncSettings.ts
|
|
32691
32771
|
import * as fs47 from "fs";
|
|
32692
|
-
import * as
|
|
32772
|
+
import * as path84 from "path";
|
|
32693
32773
|
import chalk227 from "chalk";
|
|
32694
32774
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
32695
|
-
const source =
|
|
32696
|
-
const target =
|
|
32775
|
+
const source = path84.join(claudeDir, "settings.json");
|
|
32776
|
+
const target = path84.join(targetBase, "settings.json");
|
|
32697
32777
|
const sourceContent = fs47.readFileSync(source, "utf8");
|
|
32698
32778
|
const sourceSettings = JSON.parse(sourceContent);
|
|
32699
32779
|
const targetExists = fs47.existsSync(target);
|
|
@@ -32733,13 +32813,13 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
32733
32813
|
|
|
32734
32814
|
// src/commands/sync.ts
|
|
32735
32815
|
var __filename4 = fileURLToPath8(import.meta.url);
|
|
32736
|
-
var __dirname5 =
|
|
32816
|
+
var __dirname5 = path85.dirname(__filename4);
|
|
32737
32817
|
async function sync(options2) {
|
|
32738
32818
|
const config = loadConfig();
|
|
32739
32819
|
const yes = options2?.yes ?? config.sync.autoConfirm;
|
|
32740
32820
|
const prune = { prune: options2?.prune, force: options2?.force };
|
|
32741
|
-
const claudeDir =
|
|
32742
|
-
const targetBase =
|
|
32821
|
+
const claudeDir = path85.join(__dirname5, "..", "claude");
|
|
32822
|
+
const targetBase = path85.join(os5.homedir(), ".claude");
|
|
32743
32823
|
const commandFiles = syncCommands(claudeDir, targetBase);
|
|
32744
32824
|
syncDesign(claudeDir, targetBase);
|
|
32745
32825
|
await syncSettings(claudeDir, targetBase, { yes });
|
|
@@ -32747,21 +32827,21 @@ async function sync(options2) {
|
|
|
32747
32827
|
syncCodex(claudeDir, prune);
|
|
32748
32828
|
syncPi(claudeDir, prune);
|
|
32749
32829
|
if (!options2?.prune) return;
|
|
32750
|
-
const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) =>
|
|
32830
|
+
const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) => path85.basename(file, ".md"));
|
|
32751
32831
|
const force = options2.force ?? false;
|
|
32752
32832
|
reportPrune(
|
|
32753
32833
|
"~/.claude/commands",
|
|
32754
|
-
pruneCommands(
|
|
32834
|
+
pruneCommands(path85.join(targetBase, "commands"), commandNames, { force }),
|
|
32755
32835
|
force
|
|
32756
32836
|
);
|
|
32757
32837
|
}
|
|
32758
32838
|
function syncCommands(claudeDir, targetBase) {
|
|
32759
|
-
const sourceDir =
|
|
32760
|
-
const targetDir =
|
|
32839
|
+
const sourceDir = path85.join(claudeDir, "commands");
|
|
32840
|
+
const targetDir = path85.join(targetBase, "commands");
|
|
32761
32841
|
fs48.mkdirSync(targetDir, { recursive: true });
|
|
32762
32842
|
const files = fs48.readdirSync(sourceDir);
|
|
32763
32843
|
for (const file of files) {
|
|
32764
|
-
fs48.copyFileSync(
|
|
32844
|
+
fs48.copyFileSync(path85.join(sourceDir, file), path85.join(targetDir, file));
|
|
32765
32845
|
console.log(`Copied ${file} to ${targetDir}`);
|
|
32766
32846
|
}
|
|
32767
32847
|
console.log(`Synced ${files.length} command(s) to ~/.claude/commands`);
|
|
@@ -33164,7 +33244,7 @@ function list4() {
|
|
|
33164
33244
|
|
|
33165
33245
|
// src/commands/transcript/move.ts
|
|
33166
33246
|
import { existsSync as existsSync73, mkdirSync as mkdirSync28, renameSync as renameSync2, writeFileSync as writeFileSync46 } from "fs";
|
|
33167
|
-
import { basename as
|
|
33247
|
+
import { basename as basename22, join as join85 } from "path";
|
|
33168
33248
|
|
|
33169
33249
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
33170
33250
|
function convertVttToMarkdown(inputPath) {
|
|
@@ -33185,13 +33265,13 @@ function move(file, options2) {
|
|
|
33185
33265
|
process.exit(1);
|
|
33186
33266
|
}
|
|
33187
33267
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
33188
|
-
const filename =
|
|
33268
|
+
const filename = basename22(file);
|
|
33189
33269
|
const sourcePath = join85(vttDir, filename);
|
|
33190
33270
|
if (!existsSync73(sourcePath)) {
|
|
33191
33271
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
33192
33272
|
process.exit(1);
|
|
33193
33273
|
}
|
|
33194
|
-
const base =
|
|
33274
|
+
const base = basename22(filename, ".vtt").replace(/ Transcription$/, "");
|
|
33195
33275
|
const outputName = `${date} ${base}.md`;
|
|
33196
33276
|
const formattedDir = join85(transcriptsDir, client);
|
|
33197
33277
|
mkdirSync28(formattedDir, { recursive: true });
|
|
@@ -33205,7 +33285,7 @@ function move(file, options2) {
|
|
|
33205
33285
|
|
|
33206
33286
|
// src/commands/transcript/merge.ts
|
|
33207
33287
|
import { existsSync as existsSync74, writeFileSync as writeFileSync47 } from "fs";
|
|
33208
|
-
import { basename as
|
|
33288
|
+
import { basename as basename23 } from "path";
|
|
33209
33289
|
|
|
33210
33290
|
// src/commands/transcript/failTranscript.ts
|
|
33211
33291
|
function failTranscript(message3) {
|
|
@@ -33351,7 +33431,7 @@ function readSource2(file) {
|
|
|
33351
33431
|
if (!existsSync74(file)) failTranscript(`VTT file not found: ${file}`);
|
|
33352
33432
|
const cues = readCleanedCues(file);
|
|
33353
33433
|
if (cues.length === 0) failTranscript(`no cues found in: ${file}`);
|
|
33354
|
-
return { path: file, name:
|
|
33434
|
+
return { path: file, name: basename23(file), cues };
|
|
33355
33435
|
}
|
|
33356
33436
|
function wholePassages(sources) {
|
|
33357
33437
|
return sources.map((source) => ({
|
|
@@ -33880,11 +33960,11 @@ var webUiPrefix = "src/commands/sessions/web/ui/";
|
|
|
33880
33960
|
var sessionsPrefix = "src/commands/sessions/";
|
|
33881
33961
|
var rules = [
|
|
33882
33962
|
{
|
|
33883
|
-
matches: (
|
|
33963
|
+
matches: (path91) => path91.startsWith(webUiPrefix),
|
|
33884
33964
|
advice: "restart the web server, then hard-reload the browser tab"
|
|
33885
33965
|
},
|
|
33886
33966
|
{
|
|
33887
|
-
matches: (
|
|
33967
|
+
matches: (path91) => path91.startsWith(sessionsPrefix) && !path91.startsWith(webUiPrefix),
|
|
33888
33968
|
advice: "restart the daemon"
|
|
33889
33969
|
}
|
|
33890
33970
|
];
|
|
@@ -33895,31 +33975,31 @@ function restartAdvice(paths) {
|
|
|
33895
33975
|
// src/commands/watch/syncAdvice.ts
|
|
33896
33976
|
var rules2 = [
|
|
33897
33977
|
{
|
|
33898
|
-
matches: (
|
|
33978
|
+
matches: (path91) => path91.startsWith("claude/commands/"),
|
|
33899
33979
|
reason: "claude/commands changed"
|
|
33900
33980
|
},
|
|
33901
33981
|
{
|
|
33902
|
-
matches: (
|
|
33982
|
+
matches: (path91) => path91.startsWith("claude/skills/"),
|
|
33903
33983
|
reason: "claude/skills changed"
|
|
33904
33984
|
},
|
|
33905
33985
|
{
|
|
33906
|
-
matches: (
|
|
33986
|
+
matches: (path91) => path91 === "claude/settings.json",
|
|
33907
33987
|
reason: "claude/settings.json changed"
|
|
33908
33988
|
},
|
|
33909
33989
|
{
|
|
33910
|
-
matches: (
|
|
33990
|
+
matches: (path91) => path91 === "claude/CLAUDE.md",
|
|
33911
33991
|
reason: "claude/CLAUDE.md changed"
|
|
33912
33992
|
},
|
|
33913
33993
|
{
|
|
33914
|
-
matches: (
|
|
33994
|
+
matches: (path91) => path91 === "claude/design-system-prompt.md",
|
|
33915
33995
|
reason: "claude/design-system-prompt.md changed"
|
|
33916
33996
|
},
|
|
33917
33997
|
{
|
|
33918
|
-
matches: (
|
|
33998
|
+
matches: (path91) => path91.startsWith("codex/"),
|
|
33919
33999
|
reason: "codex sources changed"
|
|
33920
34000
|
},
|
|
33921
34001
|
{
|
|
33922
|
-
matches: (
|
|
34002
|
+
matches: (path91) => path91.startsWith("pi/"),
|
|
33923
34003
|
reason: "pi sources changed"
|
|
33924
34004
|
}
|
|
33925
34005
|
];
|
|
@@ -34627,9 +34707,9 @@ function findPortFile(roamDir) {
|
|
|
34627
34707
|
return void 0;
|
|
34628
34708
|
}
|
|
34629
34709
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
34630
|
-
const
|
|
34710
|
+
const path91 = join93(roamDir, name);
|
|
34631
34711
|
try {
|
|
34632
|
-
return { path:
|
|
34712
|
+
return { path: path91, mtimeMs: statSync12(path91).mtimeMs };
|
|
34633
34713
|
} catch {
|
|
34634
34714
|
return void 0;
|
|
34635
34715
|
}
|
|
@@ -34873,11 +34953,11 @@ function findLinkIndex() {
|
|
|
34873
34953
|
function parseLinkArgs() {
|
|
34874
34954
|
const idx = findLinkIndex();
|
|
34875
34955
|
if (idx === -1) return null;
|
|
34876
|
-
const
|
|
34956
|
+
const path91 = process.argv[idx + 1];
|
|
34877
34957
|
const rest = process.argv.slice(idx + 2);
|
|
34878
34958
|
const { value: prefix2 } = extractOption(rest, "--prefix");
|
|
34879
34959
|
if (!prefix2) return null;
|
|
34880
|
-
return { path:
|
|
34960
|
+
return { path: path91, prefix: prefix2 };
|
|
34881
34961
|
}
|
|
34882
34962
|
function hasDuplicateLink(runList, linkPath) {
|
|
34883
34963
|
return runList.some(
|
|
@@ -35619,14 +35699,14 @@ import * as pty from "node-pty";
|
|
|
35619
35699
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
35620
35700
|
import { chmodSync, existsSync as existsSync85, statSync as statSync13 } from "fs";
|
|
35621
35701
|
import { createRequire as createRequire3 } from "module";
|
|
35622
|
-
import
|
|
35702
|
+
import path86 from "path";
|
|
35623
35703
|
var require4 = createRequire3(import.meta.url);
|
|
35624
35704
|
var ensured = false;
|
|
35625
35705
|
function ensureSpawnHelperExecutable() {
|
|
35626
35706
|
if (ensured || process.platform !== "darwin") return;
|
|
35627
35707
|
ensured = true;
|
|
35628
|
-
const ptyRoot =
|
|
35629
|
-
const helper =
|
|
35708
|
+
const ptyRoot = path86.join(path86.dirname(require4.resolve("node-pty")), "..");
|
|
35709
|
+
const helper = path86.join(
|
|
35630
35710
|
ptyRoot,
|
|
35631
35711
|
"prebuilds",
|
|
35632
35712
|
`${process.platform}-${process.arch}`,
|
|
@@ -35747,12 +35827,12 @@ function serverRunMeta(runName, cwd) {
|
|
|
35747
35827
|
|
|
35748
35828
|
// src/commands/sessions/daemon/readDesignSystemPrompt.ts
|
|
35749
35829
|
import * as fs49 from "fs";
|
|
35750
|
-
import * as
|
|
35830
|
+
import * as path87 from "path";
|
|
35751
35831
|
import { fileURLToPath as fileURLToPath10 } from "url";
|
|
35752
35832
|
var __filename5 = fileURLToPath10(import.meta.url);
|
|
35753
|
-
var __dirname7 =
|
|
35833
|
+
var __dirname7 = path87.dirname(__filename5);
|
|
35754
35834
|
function readDesignSystemPrompt() {
|
|
35755
|
-
const promptPath =
|
|
35835
|
+
const promptPath = path87.join(
|
|
35756
35836
|
__dirname7,
|
|
35757
35837
|
"..",
|
|
35758
35838
|
"claude",
|
|
@@ -35851,7 +35931,7 @@ function setStatus2(session, newStatus) {
|
|
|
35851
35931
|
|
|
35852
35932
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
35853
35933
|
import { existsSync as existsSync88 } from "fs";
|
|
35854
|
-
import { basename as
|
|
35934
|
+
import { basename as basename24 } from "path";
|
|
35855
35935
|
|
|
35856
35936
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
35857
35937
|
import { existsSync as existsSync87 } from "fs";
|
|
@@ -35994,7 +36074,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
35994
36074
|
const clone = owningClone(worktreePath);
|
|
35995
36075
|
const removal = await removeTree(clone, worktreePath, force);
|
|
35996
36076
|
if (!removal.removed) return removal;
|
|
35997
|
-
await deleteWorktreeBranch(clone,
|
|
36077
|
+
await deleteWorktreeBranch(clone, basename24(worktreePath));
|
|
35998
36078
|
forgetWorktree(worktreePath);
|
|
35999
36079
|
daemonLog(`worktree ${worktreePath} reaped${force ? " (forced)" : ""}`);
|
|
36000
36080
|
return removal;
|
|
@@ -36748,8 +36828,8 @@ async function seedRunningMsFromUsage(session, notify2) {
|
|
|
36748
36828
|
var DEBOUNCE_MS2 = 50;
|
|
36749
36829
|
function watchActivity(session, notify2, onClaudeSessionId) {
|
|
36750
36830
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
36751
|
-
const
|
|
36752
|
-
const dir = dirname39(
|
|
36831
|
+
const path91 = activityPath(session.id);
|
|
36832
|
+
const dir = dirname39(path91);
|
|
36753
36833
|
try {
|
|
36754
36834
|
mkdirSync34(dir, { recursive: true });
|
|
36755
36835
|
} catch {
|
|
@@ -36759,7 +36839,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
36759
36839
|
let timer = null;
|
|
36760
36840
|
const read3 = () => {
|
|
36761
36841
|
timer = null;
|
|
36762
|
-
const activity2 = readActivity(
|
|
36842
|
+
const activity2 = readActivity(path91);
|
|
36763
36843
|
if (!activity2) return;
|
|
36764
36844
|
applyActivityToSession(session, activity2);
|
|
36765
36845
|
if (activity2.claudeSessionId) onClaudeSessionId?.(session);
|
|
@@ -36768,11 +36848,11 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
36768
36848
|
notify2();
|
|
36769
36849
|
};
|
|
36770
36850
|
session.activityWatcher = watch2(dir, (_event, filename) => {
|
|
36771
|
-
if (filename && !
|
|
36851
|
+
if (filename && !path91.endsWith(filename)) return;
|
|
36772
36852
|
if (timer) clearTimeout(timer);
|
|
36773
36853
|
timer = setTimeout(read3, DEBOUNCE_MS2);
|
|
36774
36854
|
});
|
|
36775
|
-
if (existsSync91(
|
|
36855
|
+
if (existsSync91(path91)) read3();
|
|
36776
36856
|
}
|
|
36777
36857
|
function refreshActivity(session) {
|
|
36778
36858
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -36915,12 +36995,12 @@ import { watch as watch3 } from "fs";
|
|
|
36915
36995
|
|
|
36916
36996
|
// src/commands/sessions/shared/findTranscriptPathSync.ts
|
|
36917
36997
|
import * as fs51 from "fs";
|
|
36918
|
-
import * as
|
|
36998
|
+
import * as path88 from "path";
|
|
36919
36999
|
function projectDirForCwd(cwd) {
|
|
36920
|
-
return
|
|
37000
|
+
return path88.join(claudeProjectsRoot(), projectSlug(cwd));
|
|
36921
37001
|
}
|
|
36922
37002
|
function transcriptPathFor(cwd, claudeSessionId) {
|
|
36923
|
-
return
|
|
37003
|
+
return path88.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
|
|
36924
37004
|
}
|
|
36925
37005
|
function findTranscriptPathSync(cwd, claudeSessionId) {
|
|
36926
37006
|
const direct = transcriptPathFor(cwd, claudeSessionId);
|
|
@@ -36934,8 +37014,8 @@ function findTranscriptPathSync(cwd, claudeSessionId) {
|
|
|
36934
37014
|
}
|
|
36935
37015
|
for (const file of files) {
|
|
36936
37016
|
if (!file.endsWith(".jsonl")) continue;
|
|
36937
|
-
if (headContainsSessionId(
|
|
36938
|
-
return
|
|
37017
|
+
if (headContainsSessionId(path88.join(dir, file), claudeSessionId))
|
|
37018
|
+
return path88.join(dir, file);
|
|
36939
37019
|
}
|
|
36940
37020
|
return null;
|
|
36941
37021
|
}
|
|
@@ -38109,9 +38189,9 @@ function tempRoots() {
|
|
|
38109
38189
|
}
|
|
38110
38190
|
return [...roots];
|
|
38111
38191
|
}
|
|
38112
|
-
function underTempRoot(
|
|
38192
|
+
function underTempRoot(path91) {
|
|
38113
38193
|
return tempRoots().some(
|
|
38114
|
-
(root) =>
|
|
38194
|
+
(root) => path91.startsWith(root.endsWith(sep2) ? root : root + sep2)
|
|
38115
38195
|
);
|
|
38116
38196
|
}
|
|
38117
38197
|
|
|
@@ -38496,7 +38576,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
38496
38576
|
|
|
38497
38577
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
38498
38578
|
import { existsSync as existsSync94 } from "fs";
|
|
38499
|
-
import { basename as
|
|
38579
|
+
import { basename as basename26 } from "path";
|
|
38500
38580
|
|
|
38501
38581
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
38502
38582
|
function accountedTrees(sessions) {
|
|
@@ -38553,15 +38633,15 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
38553
38633
|
import { existsSync as existsSync93 } from "fs";
|
|
38554
38634
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
38555
38635
|
if (!existsSync93(clone)) {
|
|
38556
|
-
for (const { path:
|
|
38636
|
+
for (const { path: path91 } of paths) forgetWorktree(path91);
|
|
38557
38637
|
daemonLog(
|
|
38558
38638
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
38559
38639
|
);
|
|
38560
38640
|
return;
|
|
38561
38641
|
}
|
|
38562
38642
|
await pruneBookkeeping2(clone);
|
|
38563
|
-
for (const { path:
|
|
38564
|
-
if (await reclaimBranch(clone, branch2)) forgetWorktree(
|
|
38643
|
+
for (const { path: path91, branch: branch2 } of paths)
|
|
38644
|
+
if (await reclaimBranch(clone, branch2)) forgetWorktree(path91);
|
|
38565
38645
|
}
|
|
38566
38646
|
async function pruneBookkeeping2(clone) {
|
|
38567
38647
|
try {
|
|
@@ -38588,37 +38668,37 @@ async function reclaimBranch(clone, branch2) {
|
|
|
38588
38668
|
}
|
|
38589
38669
|
|
|
38590
38670
|
// src/commands/sessions/daemon/worktree/logVanishedTree.ts
|
|
38591
|
-
function logVanishedTree(sessions,
|
|
38671
|
+
function logVanishedTree(sessions, path91) {
|
|
38592
38672
|
const claimants = [...sessions.values()].filter(
|
|
38593
|
-
(s) => s.cwd ===
|
|
38673
|
+
(s) => s.cwd === path91 || s.worktree?.path === path91
|
|
38594
38674
|
);
|
|
38595
38675
|
if (claimants.length === 0) {
|
|
38596
|
-
daemonLog(`worktree ${
|
|
38676
|
+
daemonLog(`worktree ${path91} gone from disk and unclaimed; reclaiming it`);
|
|
38597
38677
|
return;
|
|
38598
38678
|
}
|
|
38599
38679
|
for (const s of claimants)
|
|
38600
38680
|
daemonLog(
|
|
38601
|
-
`session ${s.id} ("${s.name}") claims worktree ${
|
|
38681
|
+
`session ${s.id} ("${s.name}") claims worktree ${path91}, which is gone from disk; reclaiming it`
|
|
38602
38682
|
);
|
|
38603
38683
|
}
|
|
38604
38684
|
|
|
38605
38685
|
// src/commands/sessions/daemon/worktree/describeHeldWork.ts
|
|
38606
38686
|
var MAX_ITEMS = 20;
|
|
38607
|
-
async function describeHeldWork(
|
|
38608
|
-
if (reason4.startsWith("uncommitted")) return await changedFiles(
|
|
38609
|
-
if (reason4.startsWith("unpushed")) return await unpushedCommits(
|
|
38687
|
+
async function describeHeldWork(path91, reason4) {
|
|
38688
|
+
if (reason4.startsWith("uncommitted")) return await changedFiles(path91);
|
|
38689
|
+
if (reason4.startsWith("unpushed")) return await unpushedCommits(path91, reason4);
|
|
38610
38690
|
return { summary: reason4, items: [] };
|
|
38611
38691
|
}
|
|
38612
|
-
async function changedFiles(
|
|
38613
|
-
const status3 = await gitResult(
|
|
38692
|
+
async function changedFiles(path91) {
|
|
38693
|
+
const status3 = await gitResult(path91, ["status", "--porcelain"]);
|
|
38614
38694
|
const lines2 = status3.ok ? nonEmptyLines(status3.out) : [];
|
|
38615
38695
|
return {
|
|
38616
38696
|
summary: `${lines2.length} uncommitted ${lines2.length === 1 ? "file" : "files"}`,
|
|
38617
38697
|
items: capped(lines2)
|
|
38618
38698
|
};
|
|
38619
38699
|
}
|
|
38620
|
-
async function unpushedCommits(
|
|
38621
|
-
const log2 = await gitResult(
|
|
38700
|
+
async function unpushedCommits(path91, reason4) {
|
|
38701
|
+
const log2 = await gitResult(path91, ["log", "--oneline", "@{upstream}..HEAD"]);
|
|
38622
38702
|
if (!log2.ok) return { summary: reason4, items: [] };
|
|
38623
38703
|
const lines2 = nonEmptyLines(log2.out);
|
|
38624
38704
|
return {
|
|
@@ -38638,7 +38718,7 @@ function capped(lines2) {
|
|
|
38638
38718
|
}
|
|
38639
38719
|
|
|
38640
38720
|
// src/commands/sessions/daemon/worktree/resurfaceOrphanedWorktree.ts
|
|
38641
|
-
import { basename as
|
|
38721
|
+
import { basename as basename25 } from "path";
|
|
38642
38722
|
function resurfaceOrphanedWorktree(sessions, spawnWith, recovered, notify2) {
|
|
38643
38723
|
const { orphan, reason: reason4, held } = recovered;
|
|
38644
38724
|
let id;
|
|
@@ -38661,7 +38741,7 @@ function orphanedSession(id, recovered) {
|
|
|
38661
38741
|
const { orphan, reason: reason4, held } = recovered;
|
|
38662
38742
|
return {
|
|
38663
38743
|
...sessionBase(id, "stopped"),
|
|
38664
|
-
name: `recovered ${
|
|
38744
|
+
name: `recovered ${basename25(orphan.path)}`,
|
|
38665
38745
|
subtitle: `${held.summary} in ${orphan.path}`,
|
|
38666
38746
|
commandType: "claude",
|
|
38667
38747
|
pty: null,
|
|
@@ -38710,24 +38790,24 @@ function reconcileWorktreesOnRestore(sessions, spawnWith, notify2) {
|
|
|
38710
38790
|
async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
38711
38791
|
const accounted = accountedTrees(sessions);
|
|
38712
38792
|
const vanished = /* @__PURE__ */ new Map();
|
|
38713
|
-
for (const { path:
|
|
38714
|
-
if (underTempRoot(
|
|
38715
|
-
forgetWorktree(
|
|
38793
|
+
for (const { path: path91, clone } of readWorktreeRegistry()) {
|
|
38794
|
+
if (underTempRoot(path91)) {
|
|
38795
|
+
forgetWorktree(path91);
|
|
38716
38796
|
daemonLog(
|
|
38717
|
-
`worktree ${
|
|
38797
|
+
`worktree ${path91} lies outside any project root; pruned from the registry rather than recovered`
|
|
38718
38798
|
);
|
|
38719
38799
|
continue;
|
|
38720
38800
|
}
|
|
38721
|
-
if (!existsSync94(
|
|
38722
|
-
logVanishedTree(sessions,
|
|
38801
|
+
if (!existsSync94(path91)) {
|
|
38802
|
+
logVanishedTree(sessions, path91);
|
|
38723
38803
|
vanished.set(clone, [
|
|
38724
38804
|
...vanished.get(clone) ?? [],
|
|
38725
|
-
{ path:
|
|
38805
|
+
{ path: path91, branch: basename26(path91) }
|
|
38726
38806
|
]);
|
|
38727
38807
|
continue;
|
|
38728
38808
|
}
|
|
38729
|
-
if (accounted.has(
|
|
38730
|
-
await recoverOrphan(sessions, spawnWith, { path:
|
|
38809
|
+
if (accounted.has(path91)) continue;
|
|
38810
|
+
await recoverOrphan(sessions, spawnWith, { path: path91, clone }, notify2);
|
|
38731
38811
|
}
|
|
38732
38812
|
for (const [clone, paths] of vanished)
|
|
38733
38813
|
await reclaimVanishedWorktrees(clone, paths);
|
|
@@ -40479,12 +40559,12 @@ function handleSetStatus(client, m, d) {
|
|
|
40479
40559
|
import * as fs54 from "fs";
|
|
40480
40560
|
|
|
40481
40561
|
// src/commands/sessions/shared/codex/findCodexRolloutPath.ts
|
|
40482
|
-
import * as
|
|
40562
|
+
import * as path89 from "path";
|
|
40483
40563
|
async function findCodexRolloutPath(sessionId) {
|
|
40484
40564
|
if (!sessionId) return null;
|
|
40485
40565
|
const paths = await discoverCodexRolloutPaths();
|
|
40486
40566
|
const suffix = `-${sessionId}.jsonl`;
|
|
40487
|
-
return paths.find((file) =>
|
|
40567
|
+
return paths.find((file) => path89.basename(file).endsWith(suffix)) ?? null;
|
|
40488
40568
|
}
|
|
40489
40569
|
|
|
40490
40570
|
// src/commands/sessions/shared/codex/codexToolTarget.ts
|
|
@@ -41401,7 +41481,7 @@ async function statusLine() {
|
|
|
41401
41481
|
|
|
41402
41482
|
// src/commands/update.ts
|
|
41403
41483
|
import { execSync as execSync63 } from "child_process";
|
|
41404
|
-
import * as
|
|
41484
|
+
import * as path90 from "path";
|
|
41405
41485
|
|
|
41406
41486
|
// src/commands/restartDaemonAfterUpdate.ts
|
|
41407
41487
|
async function restartDaemonAfterUpdate() {
|
|
@@ -41420,12 +41500,12 @@ async function restartDaemonAfterUpdate() {
|
|
|
41420
41500
|
// src/commands/update.ts
|
|
41421
41501
|
function isGlobalNpmInstall(dir) {
|
|
41422
41502
|
try {
|
|
41423
|
-
const resolved =
|
|
41424
|
-
if (resolved.split(
|
|
41503
|
+
const resolved = path90.resolve(dir);
|
|
41504
|
+
if (resolved.split(path90.sep).includes("node_modules")) {
|
|
41425
41505
|
return true;
|
|
41426
41506
|
}
|
|
41427
41507
|
const globalPrefix = execSync63("npm prefix -g", { stdio: "pipe" }).toString().trim();
|
|
41428
|
-
return resolved.toLowerCase().startsWith(
|
|
41508
|
+
return resolved.toLowerCase().startsWith(path90.resolve(globalPrefix).toLowerCase());
|
|
41429
41509
|
} catch {
|
|
41430
41510
|
return false;
|
|
41431
41511
|
}
|