@staff0rd/assist 0.600.0 → 0.601.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/claude/commands/adopt-rules.md +79 -0
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +532 -499
- 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.601.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -187,8 +187,8 @@ function getRemoteOriginUrl(cwd) {
|
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
// src/commands/backlog/getCurrentOrigin.ts
|
|
190
|
-
function stripLeadingSlashes(
|
|
191
|
-
return
|
|
190
|
+
function stripLeadingSlashes(path90) {
|
|
191
|
+
return path90.replace(/^\/+/, "");
|
|
192
192
|
}
|
|
193
193
|
function normalizeOrigin(raw) {
|
|
194
194
|
const trimmed = raw.trim().replace(/\.git$/i, "").replace(/\/+$/, "");
|
|
@@ -238,9 +238,9 @@ function findGitLink(dir) {
|
|
|
238
238
|
}
|
|
239
239
|
return null;
|
|
240
240
|
}
|
|
241
|
-
function isFile(
|
|
241
|
+
function isFile(path90) {
|
|
242
242
|
try {
|
|
243
|
-
return statSync(
|
|
243
|
+
return statSync(path90).isFile();
|
|
244
244
|
} catch {
|
|
245
245
|
return false;
|
|
246
246
|
}
|
|
@@ -259,9 +259,9 @@ function linkedGitDirParent(gitDir) {
|
|
|
259
259
|
const match = /^(.*)[/\\]worktrees[/\\][^/\\]+[/\\]?$/.exec(gitDir);
|
|
260
260
|
return match ? match[1] : null;
|
|
261
261
|
}
|
|
262
|
-
function readTrimmed(
|
|
262
|
+
function readTrimmed(path90) {
|
|
263
263
|
try {
|
|
264
|
-
const content = readFileSync(
|
|
264
|
+
const content = readFileSync(path90, "utf8").trim();
|
|
265
265
|
return content === "" ? null : content;
|
|
266
266
|
} catch {
|
|
267
267
|
return null;
|
|
@@ -274,10 +274,10 @@ function absolute(target, from) {
|
|
|
274
274
|
// src/shared/loadRawYaml.ts
|
|
275
275
|
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
276
276
|
import { parse as parseYaml } from "yaml";
|
|
277
|
-
function loadRawYaml(
|
|
278
|
-
if (!existsSync2(
|
|
277
|
+
function loadRawYaml(path90) {
|
|
278
|
+
if (!existsSync2(path90)) return {};
|
|
279
279
|
try {
|
|
280
|
-
const content = readFileSync2(
|
|
280
|
+
const content = readFileSync2(path90, "utf8");
|
|
281
281
|
return parseYaml(content) || {};
|
|
282
282
|
} catch {
|
|
283
283
|
return {};
|
|
@@ -349,8 +349,8 @@ function mergeRawConfigs(globalRaw, projectRaw) {
|
|
|
349
349
|
// src/commands/backlog/originDisplayName.ts
|
|
350
350
|
function originDisplayName(origin) {
|
|
351
351
|
if (origin.startsWith("local:")) {
|
|
352
|
-
const
|
|
353
|
-
const segments =
|
|
352
|
+
const path90 = origin.slice("local:".length).replace(/\/+$/, "");
|
|
353
|
+
const segments = path90.split("/").filter(Boolean);
|
|
354
354
|
return segments[segments.length - 1] ?? origin;
|
|
355
355
|
}
|
|
356
356
|
const firstSlash = origin.indexOf("/");
|
|
@@ -1785,8 +1785,8 @@ function findUnmergedPaths() {
|
|
|
1785
1785
|
}
|
|
1786
1786
|
const found = /* @__PURE__ */ new Set();
|
|
1787
1787
|
for (const line of output.split("\n")) {
|
|
1788
|
-
const
|
|
1789
|
-
if (
|
|
1788
|
+
const path90 = line.split(" ")[1];
|
|
1789
|
+
if (path90) found.add(path90.trim());
|
|
1790
1790
|
}
|
|
1791
1791
|
return [...found];
|
|
1792
1792
|
}
|
|
@@ -1896,8 +1896,8 @@ function getPreferredRemoteRepo(cwd) {
|
|
|
1896
1896
|
function gitRefUrl(kind, ref, cwd) {
|
|
1897
1897
|
const repo = getPreferredRemoteRepo(cwd);
|
|
1898
1898
|
if (!repo) return void 0;
|
|
1899
|
-
const
|
|
1900
|
-
return `https://github.com/${repo.org}/${repo.repo}/${
|
|
1899
|
+
const path90 = kind === "branch" ? "tree" : "commit";
|
|
1900
|
+
return `https://github.com/${repo.org}/${repo.repo}/${path90}/${ref}`;
|
|
1901
1901
|
}
|
|
1902
1902
|
|
|
1903
1903
|
// src/commands/commit/collectCommitRefs.ts
|
|
@@ -4273,11 +4273,11 @@ function enumValues(node) {
|
|
|
4273
4273
|
function opaqueConfigNode(inner, base) {
|
|
4274
4274
|
return { ...base, kind: "other", type: leafTypeOf(inner) };
|
|
4275
4275
|
}
|
|
4276
|
-
function build(node,
|
|
4276
|
+
function build(node, path90) {
|
|
4277
4277
|
const { inner, defaultValue, optional } = unwrapSchemaNode(node);
|
|
4278
4278
|
const secret = isSecretSchemaNode(node) || isSecretSchemaNode(inner);
|
|
4279
4279
|
const base = {
|
|
4280
|
-
path:
|
|
4280
|
+
path: path90,
|
|
4281
4281
|
...optional ? { optional: true } : {},
|
|
4282
4282
|
...defaultValue === void 0 ? {} : { defaultValue },
|
|
4283
4283
|
...secret ? { secret: true } : {}
|
|
@@ -4296,9 +4296,9 @@ function segmentText(segment) {
|
|
|
4296
4296
|
if (segment.kind === "index") return `[${segment.index}]`;
|
|
4297
4297
|
return "[]";
|
|
4298
4298
|
}
|
|
4299
|
-
function formatConfigPath(
|
|
4299
|
+
function formatConfigPath(path90) {
|
|
4300
4300
|
let text18 = "";
|
|
4301
|
-
for (const segment of
|
|
4301
|
+
for (const segment of path90) {
|
|
4302
4302
|
const dotted = segment.kind === "key" || segment.kind === "entry";
|
|
4303
4303
|
const rendered = segmentText(segment);
|
|
4304
4304
|
text18 += dotted && text18 ? `.${rendered}` : rendered;
|
|
@@ -4946,9 +4946,9 @@ import { existsSync as existsSync13, readFileSync as readFileSync10 } from "fs";
|
|
|
4946
4946
|
|
|
4947
4947
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
4948
4948
|
import { minimatch as minimatch2 } from "minimatch";
|
|
4949
|
-
function resolveStringsAtPath(data,
|
|
4949
|
+
function resolveStringsAtPath(data, path90) {
|
|
4950
4950
|
let current = data;
|
|
4951
|
-
for (const segment of
|
|
4951
|
+
for (const segment of path90.split(".")) {
|
|
4952
4952
|
if (current === null || typeof current !== "object") return [];
|
|
4953
4953
|
current = current[segment];
|
|
4954
4954
|
}
|
|
@@ -4961,10 +4961,10 @@ function resolveStringsAtPath(data, path88) {
|
|
|
4961
4961
|
}
|
|
4962
4962
|
function findRuleViolations(data, rule) {
|
|
4963
4963
|
const violations = [];
|
|
4964
|
-
for (const
|
|
4965
|
-
for (const value of resolveStringsAtPath(data,
|
|
4964
|
+
for (const path90 of rule.paths) {
|
|
4965
|
+
for (const value of resolveStringsAtPath(data, path90)) {
|
|
4966
4966
|
if (minimatch2(value, rule.disallowed))
|
|
4967
|
-
violations.push({ file: rule.file, path:
|
|
4967
|
+
violations.push({ file: rule.file, path: path90, value });
|
|
4968
4968
|
}
|
|
4969
4969
|
}
|
|
4970
4970
|
return violations;
|
|
@@ -5003,8 +5003,8 @@ function forbiddenStrings() {
|
|
|
5003
5003
|
process.exit(0);
|
|
5004
5004
|
}
|
|
5005
5005
|
console.log("Forbidden strings found:\n");
|
|
5006
|
-
for (const { file, path:
|
|
5007
|
-
console.log(` ${file} ${
|
|
5006
|
+
for (const { file, path: path90, value } of violations) {
|
|
5007
|
+
console.log(` ${file} ${path90}: ${value}`);
|
|
5008
5008
|
}
|
|
5009
5009
|
console.log(`
|
|
5010
5010
|
Total: ${violations.length} forbidden string(s).`);
|
|
@@ -5319,15 +5319,15 @@ function readBaselineMigrations(repoRelativeDir, ref) {
|
|
|
5319
5319
|
} catch {
|
|
5320
5320
|
return baseline;
|
|
5321
5321
|
}
|
|
5322
|
-
const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((
|
|
5323
|
-
for (const
|
|
5322
|
+
const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path90) => MIGRATION_FILE3.test(basename2(path90)));
|
|
5323
|
+
for (const path90 of paths) {
|
|
5324
5324
|
try {
|
|
5325
|
-
const content = execSync14(`git show "${ref}:${
|
|
5325
|
+
const content = execSync14(`git show "${ref}:${path90}"`, {
|
|
5326
5326
|
encoding: "utf8",
|
|
5327
5327
|
maxBuffer: 16 * 1024 * 1024,
|
|
5328
5328
|
stdio: ["pipe", "pipe", "pipe"]
|
|
5329
5329
|
});
|
|
5330
|
-
baseline.set(basename2(
|
|
5330
|
+
baseline.set(basename2(path90), content);
|
|
5331
5331
|
} catch {
|
|
5332
5332
|
}
|
|
5333
5333
|
}
|
|
@@ -6761,10 +6761,10 @@ var hooksSettings = {
|
|
|
6761
6761
|
}
|
|
6762
6762
|
};
|
|
6763
6763
|
function ensureHooksSettings() {
|
|
6764
|
-
const
|
|
6765
|
-
mkdirSync5(dirname13(
|
|
6766
|
-
writeFileSync15(
|
|
6767
|
-
return
|
|
6764
|
+
const path90 = daemonPaths.hooksSettings;
|
|
6765
|
+
mkdirSync5(dirname13(path90), { recursive: true });
|
|
6766
|
+
writeFileSync15(path90, JSON.stringify(hooksSettings, null, 2));
|
|
6767
|
+
return path90;
|
|
6768
6768
|
}
|
|
6769
6769
|
|
|
6770
6770
|
// src/shared/spawnInherit.ts
|
|
@@ -7062,9 +7062,9 @@ var LOCAL_FILES = ["backlog.jsonl", "backlog.db"];
|
|
|
7062
7062
|
function backupLocalBacklogFiles(dir) {
|
|
7063
7063
|
const moved = [];
|
|
7064
7064
|
for (const name of LOCAL_FILES) {
|
|
7065
|
-
const
|
|
7066
|
-
if (existsSync19(
|
|
7067
|
-
renameSync(
|
|
7065
|
+
const path90 = join15(dir, ".assist", name);
|
|
7066
|
+
if (existsSync19(path90)) {
|
|
7067
|
+
renameSync(path90, `${path90}.bak`);
|
|
7068
7068
|
moved.push(`${name} \u2192 ${name}.bak`);
|
|
7069
7069
|
}
|
|
7070
7070
|
}
|
|
@@ -7544,8 +7544,8 @@ var backlogItemSchema = z4.strictObject({
|
|
|
7544
7544
|
var backlogFileSchema = z4.array(backlogItemSchema);
|
|
7545
7545
|
|
|
7546
7546
|
// src/commands/backlog/parseBacklogJsonl.ts
|
|
7547
|
-
function parseBacklogJsonl(
|
|
7548
|
-
const content = readFileSync15(
|
|
7547
|
+
function parseBacklogJsonl(path90) {
|
|
7548
|
+
const content = readFileSync15(path90, "utf8").trim();
|
|
7549
7549
|
if (content.length === 0) return [];
|
|
7550
7550
|
return content.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => backlogItemSchema.parse(JSON.parse(line)));
|
|
7551
7551
|
}
|
|
@@ -8356,24 +8356,24 @@ function getOwnerPath(itemId2) {
|
|
|
8356
8356
|
function recordSignalOwner(itemId2) {
|
|
8357
8357
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
8358
8358
|
if (!sessionId) return;
|
|
8359
|
-
const
|
|
8360
|
-
mkdirSync7(dirname15(
|
|
8361
|
-
writeFileSync17(
|
|
8359
|
+
const path90 = getOwnerPath(itemId2);
|
|
8360
|
+
mkdirSync7(dirname15(path90), { recursive: true });
|
|
8361
|
+
writeFileSync17(path90, JSON.stringify({ sessionId }));
|
|
8362
8362
|
}
|
|
8363
8363
|
function readSignalOwner(itemId2) {
|
|
8364
|
-
const
|
|
8365
|
-
if (!existsSync23(
|
|
8364
|
+
const path90 = getOwnerPath(itemId2);
|
|
8365
|
+
if (!existsSync23(path90)) return void 0;
|
|
8366
8366
|
try {
|
|
8367
|
-
const parsed = JSON.parse(readFileSync16(
|
|
8367
|
+
const parsed = JSON.parse(readFileSync16(path90, "utf8"));
|
|
8368
8368
|
return parsed.sessionId;
|
|
8369
8369
|
} catch {
|
|
8370
8370
|
return void 0;
|
|
8371
8371
|
}
|
|
8372
8372
|
}
|
|
8373
8373
|
function clearSignalOwner(itemId2) {
|
|
8374
|
-
const
|
|
8374
|
+
const path90 = getOwnerPath(itemId2);
|
|
8375
8375
|
try {
|
|
8376
|
-
rmSync(
|
|
8376
|
+
rmSync(path90);
|
|
8377
8377
|
} catch {
|
|
8378
8378
|
}
|
|
8379
8379
|
}
|
|
@@ -8410,19 +8410,19 @@ function resolveSignalTarget(event, data) {
|
|
|
8410
8410
|
function writeSignal(event, data) {
|
|
8411
8411
|
const target = resolveSignalTarget(event, data);
|
|
8412
8412
|
if (!target) return;
|
|
8413
|
-
const
|
|
8414
|
-
if (!
|
|
8413
|
+
const path90 = getSignalPath(target);
|
|
8414
|
+
if (!path90) return;
|
|
8415
8415
|
const signal = { event, sessionId: target, ...data };
|
|
8416
|
-
mkdirSync8(dirname16(
|
|
8417
|
-
writeFileSync18(
|
|
8416
|
+
mkdirSync8(dirname16(path90), { recursive: true });
|
|
8417
|
+
writeFileSync18(path90, JSON.stringify(signal));
|
|
8418
8418
|
}
|
|
8419
8419
|
|
|
8420
8420
|
// src/commands/backlog/readSignal.ts
|
|
8421
8421
|
function readSignal() {
|
|
8422
|
-
const
|
|
8423
|
-
if (!
|
|
8422
|
+
const path90 = getSignalPath();
|
|
8423
|
+
if (!path90 || !existsSync24(path90)) return void 0;
|
|
8424
8424
|
try {
|
|
8425
|
-
return JSON.parse(readFileSync17(
|
|
8425
|
+
return JSON.parse(readFileSync17(path90, "utf8"));
|
|
8426
8426
|
} catch {
|
|
8427
8427
|
return void 0;
|
|
8428
8428
|
}
|
|
@@ -8619,13 +8619,13 @@ function activityPath(sessionId) {
|
|
|
8619
8619
|
function emitActivity(activity2) {
|
|
8620
8620
|
const sessionId = process.env.ASSIST_ACTIVITY_ID;
|
|
8621
8621
|
if (!sessionId) return;
|
|
8622
|
-
const
|
|
8623
|
-
mkdirSync9(dirname17(
|
|
8624
|
-
writeFileSync19(
|
|
8622
|
+
const path90 = activityPath(sessionId);
|
|
8623
|
+
mkdirSync9(dirname17(path90), { recursive: true });
|
|
8624
|
+
writeFileSync19(path90, JSON.stringify({ ...activity2, startedAt: Date.now() }));
|
|
8625
8625
|
}
|
|
8626
|
-
function readActivity(
|
|
8626
|
+
function readActivity(path90) {
|
|
8627
8627
|
try {
|
|
8628
|
-
return JSON.parse(readFileSync18(
|
|
8628
|
+
return JSON.parse(readFileSync18(path90, "utf8"));
|
|
8629
8629
|
} catch {
|
|
8630
8630
|
return void 0;
|
|
8631
8631
|
}
|
|
@@ -8635,9 +8635,9 @@ function reconcileActivity(sessionId, activity2) {
|
|
|
8635
8635
|
removeActivity(sessionId);
|
|
8636
8636
|
return;
|
|
8637
8637
|
}
|
|
8638
|
-
const
|
|
8639
|
-
mkdirSync9(dirname17(
|
|
8640
|
-
writeFileSync19(
|
|
8638
|
+
const path90 = activityPath(sessionId);
|
|
8639
|
+
mkdirSync9(dirname17(path90), { recursive: true });
|
|
8640
|
+
writeFileSync19(path90, JSON.stringify(activity2));
|
|
8641
8641
|
}
|
|
8642
8642
|
function removeActivity(sessionId) {
|
|
8643
8643
|
try {
|
|
@@ -10090,10 +10090,10 @@ function getStorePath(filename) {
|
|
|
10090
10090
|
return join26(getStoreDir(), filename);
|
|
10091
10091
|
}
|
|
10092
10092
|
function loadJson(filename) {
|
|
10093
|
-
const
|
|
10094
|
-
if (existsSync29(
|
|
10093
|
+
const path90 = getStorePath(filename);
|
|
10094
|
+
if (existsSync29(path90)) {
|
|
10095
10095
|
try {
|
|
10096
|
-
return JSON.parse(readFileSync19(
|
|
10096
|
+
return JSON.parse(readFileSync19(path90, "utf8"));
|
|
10097
10097
|
} catch {
|
|
10098
10098
|
return {};
|
|
10099
10099
|
}
|
|
@@ -10112,22 +10112,22 @@ function saveJson(filename, data) {
|
|
|
10112
10112
|
var REGISTRY_FILE = "worktrees.json";
|
|
10113
10113
|
function readWorktreeRegistry() {
|
|
10114
10114
|
const data = loadJson(REGISTRY_FILE);
|
|
10115
|
-
return Object.entries(data).filter(([, record]) => !record.reaped).map(([
|
|
10115
|
+
return Object.entries(data).filter(([, record]) => !record.reaped).map(([path90, record]) => ({ path: path90, ...record }));
|
|
10116
10116
|
}
|
|
10117
|
-
function worktreeAttributionIncludingReaped(
|
|
10118
|
-
const record = loadJson(REGISTRY_FILE)[
|
|
10117
|
+
function worktreeAttributionIncludingReaped(path90) {
|
|
10118
|
+
const record = loadJson(REGISTRY_FILE)[path90];
|
|
10119
10119
|
return record ? { clone: record.clone, origin: record.origin } : void 0;
|
|
10120
10120
|
}
|
|
10121
|
-
function recordWorktree(
|
|
10121
|
+
function recordWorktree(path90, clone, origin) {
|
|
10122
10122
|
const data = loadJson(REGISTRY_FILE);
|
|
10123
|
-
data[
|
|
10123
|
+
data[path90] = { clone, origin };
|
|
10124
10124
|
saveJson(REGISTRY_FILE, data);
|
|
10125
10125
|
}
|
|
10126
|
-
function forgetWorktree(
|
|
10126
|
+
function forgetWorktree(path90) {
|
|
10127
10127
|
const data = loadJson(REGISTRY_FILE);
|
|
10128
|
-
const record = data[
|
|
10128
|
+
const record = data[path90];
|
|
10129
10129
|
if (!record || record.reaped) return;
|
|
10130
|
-
data[
|
|
10130
|
+
data[path90] = { ...record, reaped: true };
|
|
10131
10131
|
saveJson(REGISTRY_FILE, data);
|
|
10132
10132
|
}
|
|
10133
10133
|
|
|
@@ -10878,8 +10878,8 @@ async function loadCommittedPaths(cwd, sessionId) {
|
|
|
10878
10878
|
for (const commit2 of commits2) {
|
|
10879
10879
|
const resolved = await resolveCommit(cwd, commit2.sha);
|
|
10880
10880
|
if (!resolved) continue;
|
|
10881
|
-
for (const
|
|
10882
|
-
if (!bases.has(
|
|
10881
|
+
for (const path90 of resolved.paths) {
|
|
10882
|
+
if (!bases.has(path90)) bases.set(path90, resolved.base);
|
|
10883
10883
|
}
|
|
10884
10884
|
}
|
|
10885
10885
|
return { commits: commits2, bases };
|
|
@@ -10897,16 +10897,16 @@ async function itemChangeSet(cwd, sessionId) {
|
|
|
10897
10897
|
}
|
|
10898
10898
|
function groupByBase(bases) {
|
|
10899
10899
|
const groups = /* @__PURE__ */ new Map();
|
|
10900
|
-
for (const [
|
|
10900
|
+
for (const [path90, base] of bases) {
|
|
10901
10901
|
const paths = groups.get(base);
|
|
10902
|
-
if (paths) paths.push(
|
|
10903
|
-
else groups.set(base, [
|
|
10902
|
+
if (paths) paths.push(path90);
|
|
10903
|
+
else groups.set(base, [path90]);
|
|
10904
10904
|
}
|
|
10905
10905
|
return [...groups].map(([base, paths]) => ({ base, paths: paths.sort() }));
|
|
10906
10906
|
}
|
|
10907
10907
|
async function dirtyPaths(cwd, bases) {
|
|
10908
10908
|
const output = await execGit(cwd, ["diff", "--name-only", "HEAD"]);
|
|
10909
|
-
return output.split("\n").filter((
|
|
10909
|
+
return output.split("\n").filter((path90) => path90 && !bases.has(path90)).sort();
|
|
10910
10910
|
}
|
|
10911
10911
|
|
|
10912
10912
|
// src/commands/sessions/web/scopedDiff.ts
|
|
@@ -10915,8 +10915,8 @@ async function scopedDiff(cwd, session, scope) {
|
|
|
10915
10915
|
if (scope.kind === "commit") return commitDiff(cwd, scope.sha);
|
|
10916
10916
|
return await trackedScopeDiff(cwd, session, scope) + await untrackedDiff(cwd);
|
|
10917
10917
|
}
|
|
10918
|
-
async function untrackedFileDiff(cwd,
|
|
10919
|
-
return execGit(cwd, ["diff", "--no-index", "--", "/dev/null",
|
|
10918
|
+
async function untrackedFileDiff(cwd, path90) {
|
|
10919
|
+
return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path90], {
|
|
10920
10920
|
maxBuffer: MAX_DIFF_BYTES,
|
|
10921
10921
|
allowFailure: true
|
|
10922
10922
|
});
|
|
@@ -10929,7 +10929,7 @@ async function untrackedDiff(cwd) {
|
|
|
10929
10929
|
]);
|
|
10930
10930
|
const paths = list5.split("\n").filter(Boolean);
|
|
10931
10931
|
const diffs = await Promise.all(
|
|
10932
|
-
paths.map((
|
|
10932
|
+
paths.map((path90) => untrackedFileDiff(cwd, path90))
|
|
10933
10933
|
);
|
|
10934
10934
|
return diffs.join("");
|
|
10935
10935
|
}
|
|
@@ -11022,9 +11022,9 @@ import { isAbsolute as isAbsolute2, relative as relative2, resolve as resolve10
|
|
|
11022
11022
|
function repoRoot(cwd) {
|
|
11023
11023
|
return resolve10(toGitCwd(cwd));
|
|
11024
11024
|
}
|
|
11025
|
-
function resolveWithinCwd(cwd,
|
|
11025
|
+
function resolveWithinCwd(cwd, path90) {
|
|
11026
11026
|
const root = repoRoot(cwd);
|
|
11027
|
-
const target = resolve10(root,
|
|
11027
|
+
const target = resolve10(root, path90);
|
|
11028
11028
|
const rel = relative2(root, target);
|
|
11029
11029
|
if (rel === "" || rel.startsWith("..") || isAbsolute2(rel)) return null;
|
|
11030
11030
|
return target;
|
|
@@ -11034,14 +11034,14 @@ function resolveWithinCwd(cwd, path88) {
|
|
|
11034
11034
|
function getFileTarget(req, res) {
|
|
11035
11035
|
const cwd = getCwdParam(req, res);
|
|
11036
11036
|
if (!cwd) return null;
|
|
11037
|
-
const
|
|
11037
|
+
const path90 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
|
|
11038
11038
|
"path"
|
|
11039
11039
|
);
|
|
11040
|
-
if (!
|
|
11040
|
+
if (!path90) {
|
|
11041
11041
|
respondJson(res, 400, { error: "Missing path" });
|
|
11042
11042
|
return null;
|
|
11043
11043
|
}
|
|
11044
|
-
const target = resolveWithinCwd(cwd,
|
|
11044
|
+
const target = resolveWithinCwd(cwd, path90);
|
|
11045
11045
|
if (!target) {
|
|
11046
11046
|
respondJson(res, 400, { error: "Path outside cwd" });
|
|
11047
11047
|
return null;
|
|
@@ -11116,11 +11116,11 @@ function globalConfigTargetFor(cwd) {
|
|
|
11116
11116
|
|
|
11117
11117
|
// src/commands/config/globalConfigFileLabel.ts
|
|
11118
11118
|
var WINDOWS_MOUNT_PREFIX = "/mnt/";
|
|
11119
|
-
function globalConfigFileLabel(
|
|
11120
|
-
if (
|
|
11121
|
-
if (
|
|
11122
|
-
return `${
|
|
11123
|
-
return
|
|
11119
|
+
function globalConfigFileLabel(path90) {
|
|
11120
|
+
if (path90 === getGlobalConfigPath()) return "~/.assist.yml";
|
|
11121
|
+
if (path90.startsWith(WINDOWS_MOUNT_PREFIX))
|
|
11122
|
+
return `${path90} on the Windows host`;
|
|
11123
|
+
return path90;
|
|
11124
11124
|
}
|
|
11125
11125
|
|
|
11126
11126
|
// src/commands/config/readRawConfigLayers.ts
|
|
@@ -11177,35 +11177,35 @@ function isPlainRecord(value) {
|
|
|
11177
11177
|
}
|
|
11178
11178
|
|
|
11179
11179
|
// src/shared/mapConfigSecrets.ts
|
|
11180
|
-
function mapChildren(value,
|
|
11180
|
+
function mapChildren(value, path90, childNode, map) {
|
|
11181
11181
|
if (!isPlainRecord(value)) return value;
|
|
11182
11182
|
return Object.fromEntries(
|
|
11183
11183
|
Object.entries(value).map(([name, child]) => [
|
|
11184
11184
|
name,
|
|
11185
|
-
walk(child, [...
|
|
11185
|
+
walk(child, [...path90, name], childNode(name), map)
|
|
11186
11186
|
])
|
|
11187
11187
|
);
|
|
11188
11188
|
}
|
|
11189
|
-
function mapItems(value,
|
|
11189
|
+
function mapItems(value, path90, item, map) {
|
|
11190
11190
|
if (!Array.isArray(value)) return value;
|
|
11191
|
-
return value.map((entry, index3) => walk(entry, [...
|
|
11191
|
+
return value.map((entry, index3) => walk(entry, [...path90, index3], item, map));
|
|
11192
11192
|
}
|
|
11193
|
-
function walk(value,
|
|
11193
|
+
function walk(value, path90, node, map) {
|
|
11194
11194
|
if (!node || value === void 0 || value === null) return value;
|
|
11195
|
-
if (node.secret) return map(value,
|
|
11195
|
+
if (node.secret) return map(value, path90);
|
|
11196
11196
|
switch (node.kind) {
|
|
11197
11197
|
case "object":
|
|
11198
11198
|
case "unionOfObjects":
|
|
11199
11199
|
return mapChildren(
|
|
11200
11200
|
value,
|
|
11201
|
-
|
|
11201
|
+
path90,
|
|
11202
11202
|
(name) => configNodeField(node, name),
|
|
11203
11203
|
map
|
|
11204
11204
|
);
|
|
11205
11205
|
case "objectList":
|
|
11206
|
-
return mapItems(value,
|
|
11206
|
+
return mapItems(value, path90, node.item, map);
|
|
11207
11207
|
case "record":
|
|
11208
|
-
return mapChildren(value,
|
|
11208
|
+
return mapChildren(value, path90, () => node.value, map);
|
|
11209
11209
|
default:
|
|
11210
11210
|
return value;
|
|
11211
11211
|
}
|
|
@@ -11230,9 +11230,9 @@ function isTraversable(value) {
|
|
|
11230
11230
|
function stepInto(current, key) {
|
|
11231
11231
|
return isTraversable(current) ? current[key] : void 0;
|
|
11232
11232
|
}
|
|
11233
|
-
function getNestedValue(obj,
|
|
11233
|
+
function getNestedValue(obj, path90) {
|
|
11234
11234
|
let current = obj;
|
|
11235
|
-
for (const key of
|
|
11235
|
+
for (const key of path90.split(".")) current = stepInto(current, key);
|
|
11236
11236
|
return current;
|
|
11237
11237
|
}
|
|
11238
11238
|
|
|
@@ -11282,9 +11282,9 @@ function step(node, segment) {
|
|
|
11282
11282
|
return void 0;
|
|
11283
11283
|
}
|
|
11284
11284
|
}
|
|
11285
|
-
function findConfigNode(root,
|
|
11285
|
+
function findConfigNode(root, path90) {
|
|
11286
11286
|
let current = root;
|
|
11287
|
-
for (const segment of
|
|
11287
|
+
for (const segment of path90) {
|
|
11288
11288
|
if (!current) return void 0;
|
|
11289
11289
|
current = step(current, segment);
|
|
11290
11290
|
}
|
|
@@ -11301,34 +11301,34 @@ function nameSegment(name) {
|
|
|
11301
11301
|
return name === RECORD_ENTRY_TOKEN ? { kind: "entry" } : { kind: "key", name };
|
|
11302
11302
|
}
|
|
11303
11303
|
function parseConfigPath(text18) {
|
|
11304
|
-
const
|
|
11304
|
+
const path90 = [];
|
|
11305
11305
|
let at2 = 0;
|
|
11306
11306
|
while (at2 < text18.length) {
|
|
11307
11307
|
if (text18[at2] === "[") {
|
|
11308
11308
|
const close = text18.indexOf("]", at2);
|
|
11309
11309
|
const segment = close === -1 ? void 0 : bracketSegment(text18.slice(at2 + 1, close));
|
|
11310
11310
|
if (!segment) return void 0;
|
|
11311
|
-
|
|
11311
|
+
path90.push(segment);
|
|
11312
11312
|
at2 = close + 1;
|
|
11313
11313
|
continue;
|
|
11314
11314
|
}
|
|
11315
11315
|
if (text18[at2] === ".") {
|
|
11316
|
-
if (
|
|
11316
|
+
if (path90.length === 0) return void 0;
|
|
11317
11317
|
at2 += 1;
|
|
11318
11318
|
}
|
|
11319
11319
|
const start3 = at2;
|
|
11320
11320
|
while (at2 < text18.length && text18[at2] !== "." && text18[at2] !== "[") at2 += 1;
|
|
11321
11321
|
const name = text18.slice(start3, at2);
|
|
11322
11322
|
if (!name) return void 0;
|
|
11323
|
-
|
|
11323
|
+
path90.push(nameSegment(name));
|
|
11324
11324
|
}
|
|
11325
|
-
return
|
|
11325
|
+
return path90;
|
|
11326
11326
|
}
|
|
11327
11327
|
|
|
11328
11328
|
// src/commands/config/configEntryNode.ts
|
|
11329
11329
|
function configEntryNode(root, key) {
|
|
11330
|
-
const
|
|
11331
|
-
return
|
|
11330
|
+
const path90 = parseConfigPath(key);
|
|
11331
|
+
return path90 ? findConfigNode(root, path90) : void 0;
|
|
11332
11332
|
}
|
|
11333
11333
|
|
|
11334
11334
|
// src/commands/config/configHelpForKey.ts
|
|
@@ -11463,7 +11463,7 @@ function findSynthesisForBranch(repoReviewsDir, branch2) {
|
|
|
11463
11463
|
const parent = dirname21(branchKeyPath);
|
|
11464
11464
|
const branchPrefix = basename8(branchKeyPath);
|
|
11465
11465
|
if (!existsSync32(parent)) return null;
|
|
11466
|
-
const synthesisFiles = readdirSync2(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join29(parent, name, "synthesis.md")).filter((
|
|
11466
|
+
const synthesisFiles = readdirSync2(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join29(parent, name, "synthesis.md")).filter((path90) => existsSync32(path90)).map((path90) => ({ path: path90, mtime: statSync4(path90).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
|
|
11467
11467
|
return synthesisFiles[0]?.path ?? null;
|
|
11468
11468
|
}
|
|
11469
11469
|
|
|
@@ -11493,12 +11493,12 @@ async function getReviewSynthesis(req, res) {
|
|
|
11493
11493
|
const cwd = getCwdParam(req, res);
|
|
11494
11494
|
if (!cwd) return;
|
|
11495
11495
|
try {
|
|
11496
|
-
const
|
|
11497
|
-
if (!
|
|
11496
|
+
const path90 = await resolveSynthesisPath(cwd);
|
|
11497
|
+
if (!path90) {
|
|
11498
11498
|
respondJson(res, 404, { error: "No synthesis found" });
|
|
11499
11499
|
return;
|
|
11500
11500
|
}
|
|
11501
|
-
respondJson(res, 200, { synthesis: readFileSync21(
|
|
11501
|
+
respondJson(res, 200, { synthesis: readFileSync21(path90, "utf8") });
|
|
11502
11502
|
} catch {
|
|
11503
11503
|
respondJson(res, 404, { error: "No synthesis found" });
|
|
11504
11504
|
}
|
|
@@ -11581,8 +11581,8 @@ function parseDiffNameStatus(output) {
|
|
|
11581
11581
|
if (!status3 || fields.length < 2) continue;
|
|
11582
11582
|
const category = categorize(status3[0]);
|
|
11583
11583
|
if (!category) continue;
|
|
11584
|
-
const
|
|
11585
|
-
if (
|
|
11584
|
+
const path90 = fields[fields.length - 1];
|
|
11585
|
+
if (path90) result[category].push(path90);
|
|
11586
11586
|
}
|
|
11587
11587
|
return result;
|
|
11588
11588
|
}
|
|
@@ -11718,21 +11718,21 @@ function subsequenceScore(text18, query) {
|
|
|
11718
11718
|
}
|
|
11719
11719
|
return score - Math.min(text18.length, MAX_LENGTH_PENALTY);
|
|
11720
11720
|
}
|
|
11721
|
-
function scoreFilePath(
|
|
11721
|
+
function scoreFilePath(path90, query) {
|
|
11722
11722
|
const needle = query.trim().toLowerCase();
|
|
11723
11723
|
if (!needle) return 0;
|
|
11724
|
-
const basename26 =
|
|
11724
|
+
const basename26 = path90.slice(path90.lastIndexOf("/") + 1);
|
|
11725
11725
|
const inBasename = subsequenceScore(basename26, needle);
|
|
11726
11726
|
if (inBasename !== null) return BASENAME_WEIGHT + inBasename;
|
|
11727
|
-
return subsequenceScore(
|
|
11727
|
+
return subsequenceScore(path90, needle);
|
|
11728
11728
|
}
|
|
11729
11729
|
|
|
11730
11730
|
// src/commands/sessions/web/rankFilePaths.ts
|
|
11731
11731
|
function rankFilePaths(paths, query, limit) {
|
|
11732
11732
|
const scored = [];
|
|
11733
|
-
for (const
|
|
11734
|
-
const score = scoreFilePath(
|
|
11735
|
-
if (score !== null) scored.push({ path:
|
|
11733
|
+
for (const path90 of paths) {
|
|
11734
|
+
const score = scoreFilePath(path90, query);
|
|
11735
|
+
if (score !== null) scored.push({ path: path90, score });
|
|
11736
11736
|
}
|
|
11737
11737
|
scored.sort((a, b) => b.score - a.score || a.path.localeCompare(b.path));
|
|
11738
11738
|
return scored.slice(0, limit).map((entry) => entry.path);
|
|
@@ -12298,38 +12298,38 @@ async function restartWeb(req, res, deps2 = {}) {
|
|
|
12298
12298
|
import { relative as relative3 } from "path";
|
|
12299
12299
|
|
|
12300
12300
|
// src/commands/sessions/web/revertPathChanges.ts
|
|
12301
|
-
async function isTracked(cwd,
|
|
12301
|
+
async function isTracked(cwd, path90) {
|
|
12302
12302
|
try {
|
|
12303
|
-
await execGit(cwd, ["ls-files", "--error-unmatch", "--",
|
|
12303
|
+
await execGit(cwd, ["ls-files", "--error-unmatch", "--", path90]);
|
|
12304
12304
|
return true;
|
|
12305
12305
|
} catch {
|
|
12306
12306
|
return false;
|
|
12307
12307
|
}
|
|
12308
12308
|
}
|
|
12309
|
-
async function isInHead(cwd,
|
|
12310
|
-
const listing = await execGit(cwd, ["ls-tree", "HEAD", "--",
|
|
12309
|
+
async function isInHead(cwd, path90) {
|
|
12310
|
+
const listing = await execGit(cwd, ["ls-tree", "HEAD", "--", path90]);
|
|
12311
12311
|
return listing.trim().length > 0;
|
|
12312
12312
|
}
|
|
12313
|
-
async function revertPathChanges(cwd,
|
|
12314
|
-
if (!await isTracked(cwd,
|
|
12315
|
-
await execGit(cwd, ["clean", "-f", "--",
|
|
12313
|
+
async function revertPathChanges(cwd, path90) {
|
|
12314
|
+
if (!await isTracked(cwd, path90)) {
|
|
12315
|
+
await execGit(cwd, ["clean", "-f", "--", path90]);
|
|
12316
12316
|
return;
|
|
12317
12317
|
}
|
|
12318
|
-
if (await isInHead(cwd,
|
|
12319
|
-
await execGit(cwd, ["checkout", "HEAD", "--",
|
|
12318
|
+
if (await isInHead(cwd, path90)) {
|
|
12319
|
+
await execGit(cwd, ["checkout", "HEAD", "--", path90]);
|
|
12320
12320
|
return;
|
|
12321
12321
|
}
|
|
12322
|
-
await execGit(cwd, ["rm", "-f", "--",
|
|
12322
|
+
await execGit(cwd, ["rm", "-f", "--", path90]);
|
|
12323
12323
|
}
|
|
12324
12324
|
|
|
12325
12325
|
// src/commands/sessions/web/revertDiffFile.ts
|
|
12326
12326
|
async function revertDiffFile(req, res) {
|
|
12327
12327
|
const resolved = getFileTarget(req, res);
|
|
12328
12328
|
if (!resolved) return;
|
|
12329
|
-
const
|
|
12329
|
+
const path90 = relative3(repoRoot(resolved.cwd), resolved.target);
|
|
12330
12330
|
try {
|
|
12331
|
-
await revertPathChanges(resolved.cwd,
|
|
12332
|
-
respondJson(res, 200, { reverted:
|
|
12331
|
+
await revertPathChanges(resolved.cwd, path90);
|
|
12332
|
+
respondJson(res, 200, { reverted: path90 });
|
|
12333
12333
|
} catch (error) {
|
|
12334
12334
|
respondJson(res, 500, {
|
|
12335
12335
|
error: error instanceof Error ? error.message : "Failed to revert file"
|
|
@@ -12351,7 +12351,7 @@ async function readJsonBody(req) {
|
|
|
12351
12351
|
function requestedPaths(body) {
|
|
12352
12352
|
const paths = body.paths;
|
|
12353
12353
|
if (!Array.isArray(paths)) return null;
|
|
12354
|
-
if (paths.some((
|
|
12354
|
+
if (paths.some((path90) => typeof path90 !== "string")) return null;
|
|
12355
12355
|
return paths;
|
|
12356
12356
|
}
|
|
12357
12357
|
async function revertDiffPaths(req, res) {
|
|
@@ -12371,10 +12371,10 @@ async function revertDiffPaths(req, res) {
|
|
|
12371
12371
|
const root = repoRoot(cwd);
|
|
12372
12372
|
const reverted = [];
|
|
12373
12373
|
const failed2 = [];
|
|
12374
|
-
for (const
|
|
12375
|
-
const target = resolveWithinCwd(cwd,
|
|
12374
|
+
for (const path90 of paths) {
|
|
12375
|
+
const target = resolveWithinCwd(cwd, path90);
|
|
12376
12376
|
if (!target) {
|
|
12377
|
-
failed2.push({ path:
|
|
12377
|
+
failed2.push({ path: path90, error: "Path outside cwd" });
|
|
12378
12378
|
continue;
|
|
12379
12379
|
}
|
|
12380
12380
|
const relativePath = relative4(root, target);
|
|
@@ -12464,11 +12464,11 @@ function coerceStructuredConfigValue(key, raw) {
|
|
|
12464
12464
|
};
|
|
12465
12465
|
}
|
|
12466
12466
|
function formatIssue(key, issue) {
|
|
12467
|
-
const
|
|
12467
|
+
const path90 = formatConfigPath([
|
|
12468
12468
|
{ kind: "key", name: key },
|
|
12469
12469
|
...issue.path.map(toSegment)
|
|
12470
12470
|
]);
|
|
12471
|
-
return `${
|
|
12471
|
+
return `${path90}: ${issue.message}`;
|
|
12472
12472
|
}
|
|
12473
12473
|
function toSegment(part) {
|
|
12474
12474
|
return typeof part === "number" ? { kind: "index", index: part } : { kind: "key", name: String(part) };
|
|
@@ -12563,9 +12563,9 @@ function coerceUnion(key, raw, types) {
|
|
|
12563
12563
|
}
|
|
12564
12564
|
|
|
12565
12565
|
// src/shared/valueAtConfigPath.ts
|
|
12566
|
-
function valueAtConfigPath(value,
|
|
12566
|
+
function valueAtConfigPath(value, path90) {
|
|
12567
12567
|
let current = value;
|
|
12568
|
-
for (const key of
|
|
12568
|
+
for (const key of path90) {
|
|
12569
12569
|
if (typeof key === "number") {
|
|
12570
12570
|
if (!Array.isArray(current)) return void 0;
|
|
12571
12571
|
current = current[key];
|
|
@@ -12582,7 +12582,7 @@ function restoreConfigSecrets(value, stored, node) {
|
|
|
12582
12582
|
return mapConfigSecrets(
|
|
12583
12583
|
value,
|
|
12584
12584
|
node,
|
|
12585
|
-
(secret,
|
|
12585
|
+
(secret, path90) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path90) : secret
|
|
12586
12586
|
);
|
|
12587
12587
|
}
|
|
12588
12588
|
|
|
@@ -12631,8 +12631,8 @@ function stepIntoNested(container, key, nextKey) {
|
|
|
12631
12631
|
}
|
|
12632
12632
|
return ensureObject(container, resolved);
|
|
12633
12633
|
}
|
|
12634
|
-
function setNestedValue(obj,
|
|
12635
|
-
const keys =
|
|
12634
|
+
function setNestedValue(obj, path90, value) {
|
|
12635
|
+
const keys = path90.split(".");
|
|
12636
12636
|
const result = { ...obj };
|
|
12637
12637
|
let current = result;
|
|
12638
12638
|
for (let i = 0; i < keys.length - 1; i++) {
|
|
@@ -12659,8 +12659,8 @@ function formatIssue2(issue, key) {
|
|
|
12659
12659
|
return issue.keys.map(
|
|
12660
12660
|
(unrecognized) => `${[...issue.path, unrecognized].join(".")}: Unrecognized key`
|
|
12661
12661
|
);
|
|
12662
|
-
const
|
|
12663
|
-
return [`${
|
|
12662
|
+
const path90 = issue.path.length > 0 ? issue.path.join(".") : key;
|
|
12663
|
+
return [`${path90}: ${issue.message}`];
|
|
12664
12664
|
}
|
|
12665
12665
|
|
|
12666
12666
|
// src/commands/config/applyConfigSet.ts
|
|
@@ -12917,8 +12917,8 @@ function removeAt(container, keys) {
|
|
|
12917
12917
|
}
|
|
12918
12918
|
return removeFromChild(container, key, rest);
|
|
12919
12919
|
}
|
|
12920
|
-
function unsetNestedValue(obj,
|
|
12921
|
-
const { container, removed } = removeAt(obj,
|
|
12920
|
+
function unsetNestedValue(obj, path90) {
|
|
12921
|
+
const { container, removed } = removeAt(obj, path90.split("."));
|
|
12922
12922
|
return { config: container, removed };
|
|
12923
12923
|
}
|
|
12924
12924
|
|
|
@@ -14032,9 +14032,9 @@ function originToSshUrl(origin) {
|
|
|
14032
14032
|
const firstSlash = origin.indexOf("/");
|
|
14033
14033
|
if (firstSlash <= 0) return null;
|
|
14034
14034
|
const host = origin.slice(0, firstSlash);
|
|
14035
|
-
const
|
|
14036
|
-
if (!
|
|
14037
|
-
return `git@${host}:${
|
|
14035
|
+
const path90 = origin.slice(firstSlash + 1);
|
|
14036
|
+
if (!path90) return null;
|
|
14037
|
+
return `git@${host}:${path90}.git`;
|
|
14038
14038
|
}
|
|
14039
14039
|
|
|
14040
14040
|
// src/commands/backlog/cloneRepo.ts
|
|
@@ -17062,9 +17062,9 @@ var __dirname4 = dirname23(__filename3);
|
|
|
17062
17062
|
function packageRoot() {
|
|
17063
17063
|
return __dirname4;
|
|
17064
17064
|
}
|
|
17065
|
-
function readLines(
|
|
17066
|
-
if (!existsSync38(
|
|
17067
|
-
return readFileSync26(
|
|
17065
|
+
function readLines(path90) {
|
|
17066
|
+
if (!existsSync38(path90)) return [];
|
|
17067
|
+
return readFileSync26(path90, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
17068
17068
|
}
|
|
17069
17069
|
var cachedReads;
|
|
17070
17070
|
var cachedWrites;
|
|
@@ -17585,14 +17585,14 @@ function showProgress(p, label2) {
|
|
|
17585
17585
|
const pct = Math.round(p.done / p.total * 100);
|
|
17586
17586
|
process.stderr.write(`\r\x1B[K[${pct}%] Scanning ${label2}...`);
|
|
17587
17587
|
}
|
|
17588
|
-
async function resolveCommand(cli,
|
|
17589
|
-
showProgress(p,
|
|
17590
|
-
const subHelp = await runHelp([cli, ...
|
|
17588
|
+
async function resolveCommand(cli, path90, description, depth, p) {
|
|
17589
|
+
showProgress(p, path90.join(" "));
|
|
17590
|
+
const subHelp = await runHelp([cli, ...path90]);
|
|
17591
17591
|
if (!subHelp || !hasSubcommands(subHelp)) {
|
|
17592
|
-
return [{ path:
|
|
17592
|
+
return [{ path: path90, description }];
|
|
17593
17593
|
}
|
|
17594
|
-
const children = await discoverAt(cli,
|
|
17595
|
-
return children.length > 0 ? children : [{ path:
|
|
17594
|
+
const children = await discoverAt(cli, path90, depth + 1, p);
|
|
17595
|
+
return children.length > 0 ? children : [{ path: path90, description }];
|
|
17596
17596
|
}
|
|
17597
17597
|
async function discoverAt(cli, parentPath, depth, p) {
|
|
17598
17598
|
if (depth > SAFETY_DEPTH) return [];
|
|
@@ -17740,9 +17740,9 @@ function logPath(cli) {
|
|
|
17740
17740
|
return join39(homedir17(), ".assist", `cli-discover-${safeName}.log`);
|
|
17741
17741
|
}
|
|
17742
17742
|
function readCache(cli) {
|
|
17743
|
-
const
|
|
17744
|
-
if (!existsSync40(
|
|
17745
|
-
return readFileSync28(
|
|
17743
|
+
const path90 = logPath(cli);
|
|
17744
|
+
if (!existsSync40(path90)) return void 0;
|
|
17745
|
+
return readFileSync28(path90, "utf8");
|
|
17746
17746
|
}
|
|
17747
17747
|
function writeCache(cli, output) {
|
|
17748
17748
|
const dir = join39(homedir17(), ".assist");
|
|
@@ -17902,9 +17902,9 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
17902
17902
|
}
|
|
17903
17903
|
const cutoff = Date.now() - STALE_AFTER_MS;
|
|
17904
17904
|
for (const entry of entries) {
|
|
17905
|
-
const
|
|
17905
|
+
const path90 = join41(dir, entry);
|
|
17906
17906
|
try {
|
|
17907
|
-
if (statSync7(
|
|
17907
|
+
if (statSync7(path90).mtimeMs < cutoff) unlinkSync7(path90);
|
|
17908
17908
|
} catch {
|
|
17909
17909
|
continue;
|
|
17910
17910
|
}
|
|
@@ -17914,10 +17914,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
17914
17914
|
// src/commands/codeComment/readPinState.ts
|
|
17915
17915
|
import { existsSync as existsSync41, readFileSync as readFileSync29 } from "fs";
|
|
17916
17916
|
function readPinState(pin) {
|
|
17917
|
-
const
|
|
17918
|
-
if (!existsSync41(
|
|
17917
|
+
const path90 = getPinStatePath(pin);
|
|
17918
|
+
if (!existsSync41(path90)) return void 0;
|
|
17919
17919
|
try {
|
|
17920
|
-
const state = JSON.parse(readFileSync29(
|
|
17920
|
+
const state = JSON.parse(readFileSync29(path90, "utf8"));
|
|
17921
17921
|
if (state.pin !== pin) return void 0;
|
|
17922
17922
|
return state;
|
|
17923
17923
|
} catch {
|
|
@@ -19056,11 +19056,11 @@ async function loadPath(source) {
|
|
|
19056
19056
|
}
|
|
19057
19057
|
}
|
|
19058
19058
|
async function criteriaExtension() {
|
|
19059
|
-
const
|
|
19059
|
+
const path90 = await loadPath(criteriaExtensionDir());
|
|
19060
19060
|
console.log(
|
|
19061
19061
|
chalk139.bold("acceptance criteria outliner \u2014 GitHub browser extension")
|
|
19062
19062
|
);
|
|
19063
|
-
console.log(chalk139.dim(`load the unpacked extension from ${
|
|
19063
|
+
console.log(chalk139.dim(`load the unpacked extension from ${path90}`));
|
|
19064
19064
|
}
|
|
19065
19065
|
|
|
19066
19066
|
// src/commands/criteriaExtension/signCriteriaExtension.ts
|
|
@@ -19185,10 +19185,10 @@ async function signCriteriaExtension() {
|
|
|
19185
19185
|
process.exitCode = 1;
|
|
19186
19186
|
return;
|
|
19187
19187
|
}
|
|
19188
|
-
const
|
|
19188
|
+
const path90 = await signedAddonInstallPath(
|
|
19189
19189
|
await copySignedXpi(xpi, ARTIFACTS_DIR)
|
|
19190
19190
|
);
|
|
19191
|
-
console.log(chalk141.dim(`install the signed add-on from ${
|
|
19191
|
+
console.log(chalk141.dim(`install the signed add-on from ${path90}`));
|
|
19192
19192
|
}
|
|
19193
19193
|
|
|
19194
19194
|
// src/commands/registerCriteriaExtension.ts
|
|
@@ -19286,10 +19286,10 @@ function getMigrationApprovalPath(migrationId) {
|
|
|
19286
19286
|
// src/commands/dbMigration/readMigrationPinState.ts
|
|
19287
19287
|
import { existsSync as existsSync46, readFileSync as readFileSync31 } from "fs";
|
|
19288
19288
|
function readMigrationPinState(pin) {
|
|
19289
|
-
const
|
|
19290
|
-
if (!existsSync46(
|
|
19289
|
+
const path90 = getMigrationPinPath(pin);
|
|
19290
|
+
if (!existsSync46(path90)) return void 0;
|
|
19291
19291
|
try {
|
|
19292
|
-
const state = JSON.parse(readFileSync31(
|
|
19292
|
+
const state = JSON.parse(readFileSync31(path90, "utf8"));
|
|
19293
19293
|
if (state.pin !== pin) return void 0;
|
|
19294
19294
|
if (!Number.isInteger(state.migrationId)) return void 0;
|
|
19295
19295
|
return state;
|
|
@@ -20719,10 +20719,10 @@ function decideCommentGuard(input, existingContent) {
|
|
|
20719
20719
|
import { existsSync as existsSync52, unlinkSync as unlinkSync11 } from "fs";
|
|
20720
20720
|
function consumeMigrationApproval(migrationId) {
|
|
20721
20721
|
sweepRestrictedDir();
|
|
20722
|
-
const
|
|
20723
|
-
if (!existsSync52(
|
|
20722
|
+
const path90 = getMigrationApprovalPath(migrationId);
|
|
20723
|
+
if (!existsSync52(path90)) return false;
|
|
20724
20724
|
try {
|
|
20725
|
-
unlinkSync11(
|
|
20725
|
+
unlinkSync11(path90);
|
|
20726
20726
|
return true;
|
|
20727
20727
|
} catch {
|
|
20728
20728
|
return false;
|
|
@@ -22416,11 +22416,11 @@ function recentDaemonLogLines() {
|
|
|
22416
22416
|
// src/commands/sessions/daemon/worktree/canonicalTreePath.ts
|
|
22417
22417
|
import { realpathSync as realpathSync2 } from "fs";
|
|
22418
22418
|
import { resolve as resolve14 } from "path";
|
|
22419
|
-
function canonicalTreePath(
|
|
22419
|
+
function canonicalTreePath(path90) {
|
|
22420
22420
|
try {
|
|
22421
|
-
return realpathSync2(
|
|
22421
|
+
return realpathSync2(path90);
|
|
22422
22422
|
} catch {
|
|
22423
|
-
return resolve14(
|
|
22423
|
+
return resolve14(path90);
|
|
22424
22424
|
}
|
|
22425
22425
|
}
|
|
22426
22426
|
|
|
@@ -22473,22 +22473,22 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
|
22473
22473
|
const registered = new Set(listWorktreePaths(clone));
|
|
22474
22474
|
const branches = new Set(listLocalBranches(clone));
|
|
22475
22475
|
const isTaken = (candidate) => registered.has(candidate) || existsSync55(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename16(candidate));
|
|
22476
|
-
const
|
|
22476
|
+
const path90 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
|
|
22477
22477
|
const start3 = worktreeStartPoint(clone, strategy.trunk);
|
|
22478
22478
|
gitSync(clone, [
|
|
22479
22479
|
"worktree",
|
|
22480
22480
|
"add",
|
|
22481
22481
|
start3.track ? "--track" : "--no-track",
|
|
22482
22482
|
"-b",
|
|
22483
|
-
basename16(
|
|
22484
|
-
|
|
22483
|
+
basename16(path90),
|
|
22484
|
+
path90,
|
|
22485
22485
|
start3.ref
|
|
22486
22486
|
]);
|
|
22487
|
-
recordWorktree(
|
|
22487
|
+
recordWorktree(path90, clone, getCurrentOrigin(clone));
|
|
22488
22488
|
daemonLog(
|
|
22489
|
-
start3.track ? `worktree allocated ${
|
|
22489
|
+
start3.track ? `worktree allocated ${path90} (branch ${basename16(path90)} tracking ${start3.ref}) for clone ${clone}` : `worktree allocated ${path90} (branch ${basename16(path90)} off ${start3.ref}, no mainline tracking) for clone ${clone}`
|
|
22490
22490
|
);
|
|
22491
|
-
return
|
|
22491
|
+
return path90;
|
|
22492
22492
|
}
|
|
22493
22493
|
|
|
22494
22494
|
// src/commands/sessions/daemon/worktree/keptInTree.ts
|
|
@@ -22629,13 +22629,13 @@ function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
|
|
|
22629
22629
|
if (forcedSpill) daemonLog(forcedSpill);
|
|
22630
22630
|
else if (reusesClone(clone, boundTreeRoots2, reuse))
|
|
22631
22631
|
return { cwd: clone, kind: "primary", created: false, clone };
|
|
22632
|
-
const
|
|
22632
|
+
const path90 = createWorktree(
|
|
22633
22633
|
clone,
|
|
22634
22634
|
{ root: cfg.root, trunk: cfg.trunk },
|
|
22635
22635
|
boundTreeRoots2,
|
|
22636
22636
|
options2.replacesTree
|
|
22637
22637
|
);
|
|
22638
|
-
return { cwd:
|
|
22638
|
+
return { cwd: path90, kind: "worktree", created: true, clone };
|
|
22639
22639
|
}
|
|
22640
22640
|
|
|
22641
22641
|
// src/commands/sessions/daemon/describePersistedSession.ts
|
|
@@ -22966,13 +22966,13 @@ function worktreeHoldingBranch(cwd, branch2) {
|
|
|
22966
22966
|
const listing = gitSyncOrNull(cwd, ["worktree", "list", "--porcelain"]);
|
|
22967
22967
|
if (!listing) return null;
|
|
22968
22968
|
const here = gitSyncOrNull(cwd, ["rev-parse", "--show-toplevel"]);
|
|
22969
|
-
let
|
|
22969
|
+
let path90 = null;
|
|
22970
22970
|
for (const line of listing.split("\n")) {
|
|
22971
22971
|
const trimmed = line.trim();
|
|
22972
22972
|
if (trimmed.startsWith("worktree "))
|
|
22973
|
-
|
|
22973
|
+
path90 = trimmed.slice("worktree ".length).trim();
|
|
22974
22974
|
else if (trimmed === `branch refs/heads/${branch2}`)
|
|
22975
|
-
return
|
|
22975
|
+
return path90 && path90 !== here ? path90 : null;
|
|
22976
22976
|
}
|
|
22977
22977
|
return null;
|
|
22978
22978
|
}
|
|
@@ -24014,9 +24014,9 @@ function parseRscRows(flight) {
|
|
|
24014
24014
|
}
|
|
24015
24015
|
function makeRscResolver(rows) {
|
|
24016
24016
|
return (ref) => {
|
|
24017
|
-
const [id, ...
|
|
24017
|
+
const [id, ...path90] = ref.slice(1).replace(/^[L@]/, "").split(":");
|
|
24018
24018
|
let v = rows[id];
|
|
24019
|
-
for (const key of
|
|
24019
|
+
for (const key of path90) {
|
|
24020
24020
|
if (v == null || typeof v !== "object") return void 0;
|
|
24021
24021
|
v = v[key];
|
|
24022
24022
|
}
|
|
@@ -24719,16 +24719,16 @@ function validateLine(line) {
|
|
|
24719
24719
|
process.exit(1);
|
|
24720
24720
|
}
|
|
24721
24721
|
}
|
|
24722
|
-
async function comment2(
|
|
24722
|
+
async function comment2(path90, line, body, startLine) {
|
|
24723
24723
|
validateBody(body);
|
|
24724
24724
|
validateLine(line);
|
|
24725
24725
|
if (startLine !== void 0) validateLine(startLine);
|
|
24726
24726
|
const range = startLine !== void 0 ? `${startLine}-${line}` : `${line}`;
|
|
24727
|
-
await reviewProposedPrComment(`Comment on ${
|
|
24727
|
+
await reviewProposedPrComment(`Comment on ${path90}:${range}`, body, null);
|
|
24728
24728
|
try {
|
|
24729
24729
|
const prId = getCurrentPrNodeId();
|
|
24730
|
-
postReviewComment({ prId, body, path:
|
|
24731
|
-
console.log(`Added review comment on ${
|
|
24730
|
+
postReviewComment({ prId, body, path: path90, line, startLine });
|
|
24731
|
+
console.log(`Added review comment on ${path90}:${range}`);
|
|
24732
24732
|
} catch (error) {
|
|
24733
24733
|
if (isGhNotInstalled(error)) {
|
|
24734
24734
|
console.error("Error: GitHub CLI (gh) is not installed.");
|
|
@@ -25930,9 +25930,9 @@ function registerPrsComments(prsCommand) {
|
|
|
25930
25930
|
});
|
|
25931
25931
|
prsCommand.command("comment <path> <line> <body>").description(
|
|
25932
25932
|
"Add a line comment to the pending review (body of - reads it from stdin)"
|
|
25933
|
-
).action(async (
|
|
25933
|
+
).action(async (path90, line, body) => {
|
|
25934
25934
|
await comment2(
|
|
25935
|
-
|
|
25935
|
+
path90,
|
|
25936
25936
|
Number.parseInt(line, 10),
|
|
25937
25937
|
await readBodyArgument(body)
|
|
25938
25938
|
);
|
|
@@ -26396,10 +26396,10 @@ function resolveOpSecret(reference) {
|
|
|
26396
26396
|
}
|
|
26397
26397
|
|
|
26398
26398
|
// src/commands/ravendb/ravenFetch.ts
|
|
26399
|
-
async function ravenFetch(connection,
|
|
26399
|
+
async function ravenFetch(connection, path90) {
|
|
26400
26400
|
const apiKey = resolveOpSecret(connection.apiKeyRef);
|
|
26401
26401
|
let accessToken = await getAccessToken(apiKey);
|
|
26402
|
-
const url = `${connection.url}${
|
|
26402
|
+
const url = `${connection.url}${path90}`;
|
|
26403
26403
|
const headers = {
|
|
26404
26404
|
Authorization: `Bearer ${accessToken}`,
|
|
26405
26405
|
"Content-Type": "application/json"
|
|
@@ -26489,16 +26489,16 @@ import chalk193 from "chalk";
|
|
|
26489
26489
|
// src/commands/ravendb/buildQueryPath.ts
|
|
26490
26490
|
function buildQueryPath(opts) {
|
|
26491
26491
|
const db = encodeURIComponent(opts.db);
|
|
26492
|
-
let
|
|
26492
|
+
let path90;
|
|
26493
26493
|
if (opts.collection) {
|
|
26494
|
-
|
|
26494
|
+
path90 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
|
|
26495
26495
|
} else {
|
|
26496
|
-
|
|
26496
|
+
path90 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
|
|
26497
26497
|
}
|
|
26498
26498
|
if (opts.query) {
|
|
26499
|
-
|
|
26499
|
+
path90 += `&query=${encodeURIComponent(opts.query)}`;
|
|
26500
26500
|
}
|
|
26501
|
-
return
|
|
26501
|
+
return path90;
|
|
26502
26502
|
}
|
|
26503
26503
|
|
|
26504
26504
|
// src/commands/ravendb/fetchAllPages.ts
|
|
@@ -26507,7 +26507,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
26507
26507
|
let start3 = 0;
|
|
26508
26508
|
while (true) {
|
|
26509
26509
|
const effectivePageSize = opts.limit !== void 0 ? Math.min(opts.pageSize, opts.limit - allResults.length) : opts.pageSize;
|
|
26510
|
-
const
|
|
26510
|
+
const path90 = buildQueryPath({
|
|
26511
26511
|
db: connection.database,
|
|
26512
26512
|
collection: opts.collection,
|
|
26513
26513
|
start: start3,
|
|
@@ -26515,7 +26515,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
26515
26515
|
sort: opts.sort,
|
|
26516
26516
|
query: opts.query
|
|
26517
26517
|
});
|
|
26518
|
-
const data = await ravenFetch(connection,
|
|
26518
|
+
const data = await ravenFetch(connection, path90);
|
|
26519
26519
|
const results = data.Results ?? [];
|
|
26520
26520
|
const totalResults = data.TotalResults ?? 0;
|
|
26521
26521
|
if (results.length === 0) break;
|
|
@@ -29123,8 +29123,8 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
|
|
|
29123
29123
|
// src/commands/review/prepareReviewDir.ts
|
|
29124
29124
|
import { existsSync as existsSync61, mkdirSync as mkdirSync21, unlinkSync as unlinkSync17, writeFileSync as writeFileSync38 } from "fs";
|
|
29125
29125
|
function clearReviewFiles(paths) {
|
|
29126
|
-
for (const
|
|
29127
|
-
if (existsSync61(
|
|
29126
|
+
for (const path90 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
29127
|
+
if (existsSync61(path90)) unlinkSync17(path90);
|
|
29128
29128
|
}
|
|
29129
29129
|
}
|
|
29130
29130
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -30173,8 +30173,8 @@ function registerReview(program2) {
|
|
|
30173
30173
|
}
|
|
30174
30174
|
|
|
30175
30175
|
// src/commands/rules/addRule.ts
|
|
30176
|
-
import { existsSync as
|
|
30177
|
-
import
|
|
30176
|
+
import { existsSync as existsSync66, readFileSync as readFileSync50, writeFileSync as writeFileSync41 } from "fs";
|
|
30177
|
+
import path71 from "path";
|
|
30178
30178
|
import chalk209 from "chalk";
|
|
30179
30179
|
|
|
30180
30180
|
// src/commands/rules/insertRuleBullet.ts
|
|
@@ -30244,6 +30244,10 @@ function resolveRuleScope(target) {
|
|
|
30244
30244
|
return path68.join(root, "CLAUDE.md");
|
|
30245
30245
|
}
|
|
30246
30246
|
|
|
30247
|
+
// src/commands/rules/updateScopedRulesIndex.ts
|
|
30248
|
+
import { existsSync as existsSync65, readFileSync as readFileSync49, writeFileSync as writeFileSync40 } from "fs";
|
|
30249
|
+
import path70 from "path";
|
|
30250
|
+
|
|
30247
30251
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
30248
30252
|
import { readFileSync as readFileSync48 } from "fs";
|
|
30249
30253
|
import path69 from "path";
|
|
@@ -30287,9 +30291,19 @@ function upsertScopedRulesPointer(content, directories) {
|
|
|
30287
30291
|
`;
|
|
30288
30292
|
}
|
|
30289
30293
|
|
|
30294
|
+
// src/commands/rules/updateScopedRulesIndex.ts
|
|
30295
|
+
function updateScopedRulesIndex(root) {
|
|
30296
|
+
const directories = scopedRuleDirectories(root);
|
|
30297
|
+
const rootFile = path70.join(root, "CLAUDE.md");
|
|
30298
|
+
const before = existsSync65(rootFile) ? readFileSync49(rootFile, "utf8") : "";
|
|
30299
|
+
const after = upsertScopedRulesPointer(before, directories);
|
|
30300
|
+
if (after !== before) writeFileSync40(rootFile, after);
|
|
30301
|
+
return directories;
|
|
30302
|
+
}
|
|
30303
|
+
|
|
30290
30304
|
// src/commands/rules/addRule.ts
|
|
30291
30305
|
function read2(file) {
|
|
30292
|
-
return
|
|
30306
|
+
return existsSync66(file) ? readFileSync50(file, "utf8") : "";
|
|
30293
30307
|
}
|
|
30294
30308
|
function addRule(text18, options2) {
|
|
30295
30309
|
const rule = text18.trim();
|
|
@@ -30299,28 +30313,44 @@ function addRule(text18, options2) {
|
|
|
30299
30313
|
return;
|
|
30300
30314
|
}
|
|
30301
30315
|
const target = resolveRuleScope(options2.scope ?? process.cwd());
|
|
30302
|
-
const targetDir =
|
|
30316
|
+
const targetDir = path71.dirname(target);
|
|
30303
30317
|
const root = findRepoRoot(targetDir) ?? targetDir;
|
|
30304
30318
|
const code = nextRuleCode(root);
|
|
30305
|
-
|
|
30306
|
-
|
|
30307
|
-
const before = read2(rootFile);
|
|
30308
|
-
const after = upsertScopedRulesPointer(before, scopedRuleDirectories(root));
|
|
30309
|
-
if (after !== before) writeFileSync40(rootFile, after);
|
|
30319
|
+
writeFileSync41(target, insertRuleBullet(read2(target), code, rule));
|
|
30320
|
+
updateScopedRulesIndex(root);
|
|
30310
30321
|
console.log(
|
|
30311
|
-
`Added ${chalk209.cyan(code)} to ${
|
|
30322
|
+
`Added ${chalk209.cyan(code)} to ${path71.relative(process.cwd(), target) || target}`
|
|
30312
30323
|
);
|
|
30313
30324
|
}
|
|
30314
30325
|
|
|
30315
|
-
// src/commands/rules/
|
|
30316
|
-
import
|
|
30326
|
+
// src/commands/rules/indexRules.ts
|
|
30327
|
+
import path72 from "path";
|
|
30317
30328
|
import chalk210 from "chalk";
|
|
30329
|
+
function indexRules(target) {
|
|
30330
|
+
const startDir = scopeDirectory(path72.resolve(target ?? process.cwd()));
|
|
30331
|
+
const root = findRepoRoot(startDir) ?? startDir;
|
|
30332
|
+
const directories = updateScopedRulesIndex(root);
|
|
30333
|
+
const rootFile = path72.relative(process.cwd(), path72.join(root, "CLAUDE.md"));
|
|
30334
|
+
if (directories.length === 0) {
|
|
30335
|
+
console.log(
|
|
30336
|
+
chalk210.gray(`No directories carry their own \`## Rules\` under ${root}`)
|
|
30337
|
+
);
|
|
30338
|
+
return;
|
|
30339
|
+
}
|
|
30340
|
+
console.log(`Recorded in ${rootFile || "CLAUDE.md"}`);
|
|
30341
|
+
for (const directory of directories)
|
|
30342
|
+
console.log(` ${chalk210.cyan(directory)}`);
|
|
30343
|
+
}
|
|
30344
|
+
|
|
30345
|
+
// src/commands/rules/listRules.ts
|
|
30346
|
+
import path73 from "path";
|
|
30347
|
+
import chalk211 from "chalk";
|
|
30318
30348
|
function listRules(target) {
|
|
30319
|
-
const resolved =
|
|
30349
|
+
const resolved = path73.resolve(target ?? process.cwd());
|
|
30320
30350
|
const rules3 = readScopedRules(resolved);
|
|
30321
30351
|
if (rules3.length === 0) {
|
|
30322
|
-
const label2 =
|
|
30323
|
-
console.log(
|
|
30352
|
+
const label2 = path73.relative(process.cwd(), resolved) || ".";
|
|
30353
|
+
console.log(chalk211.gray(`No rules in scope for ${label2}`));
|
|
30324
30354
|
return;
|
|
30325
30355
|
}
|
|
30326
30356
|
const base = findRepoRoot(scopeDirectory(resolved));
|
|
@@ -30330,10 +30360,10 @@ function listRules(target) {
|
|
|
30330
30360
|
if (rule.source !== shown) {
|
|
30331
30361
|
shown = rule.source;
|
|
30332
30362
|
console.log(
|
|
30333
|
-
|
|
30363
|
+
chalk211.dim(base ? path73.relative(base, rule.source) : rule.source)
|
|
30334
30364
|
);
|
|
30335
30365
|
}
|
|
30336
|
-
console.log(` ${
|
|
30366
|
+
console.log(` ${chalk211.cyan(rule.code.padEnd(width))} ${rule.text}`);
|
|
30337
30367
|
}
|
|
30338
30368
|
}
|
|
30339
30369
|
|
|
@@ -30351,10 +30381,13 @@ function registerRules(program2) {
|
|
|
30351
30381
|
).action(
|
|
30352
30382
|
(text18, options2) => addRule(text18, options2)
|
|
30353
30383
|
);
|
|
30384
|
+
rulesCommand.command("index [path]").description(
|
|
30385
|
+
"Record the directories that carry their own `## Rules` in the repo root's CLAUDE.md, so scoped rules are discoverable from the root"
|
|
30386
|
+
).action((target) => indexRules(target));
|
|
30354
30387
|
}
|
|
30355
30388
|
|
|
30356
30389
|
// src/commands/seq/seqAuth.ts
|
|
30357
|
-
import
|
|
30390
|
+
import chalk213 from "chalk";
|
|
30358
30391
|
|
|
30359
30392
|
// src/commands/seq/loadConnections.ts
|
|
30360
30393
|
function loadConnections2() {
|
|
@@ -30383,10 +30416,10 @@ function setDefaultConnection(name) {
|
|
|
30383
30416
|
}
|
|
30384
30417
|
|
|
30385
30418
|
// src/shared/assertUniqueName.ts
|
|
30386
|
-
import
|
|
30419
|
+
import chalk212 from "chalk";
|
|
30387
30420
|
function assertUniqueName(existingNames, name) {
|
|
30388
30421
|
if (existingNames.includes(name)) {
|
|
30389
|
-
console.error(
|
|
30422
|
+
console.error(chalk212.red(`Connection "${name}" already exists.`));
|
|
30390
30423
|
process.exit(1);
|
|
30391
30424
|
}
|
|
30392
30425
|
}
|
|
@@ -30404,18 +30437,18 @@ async function promptConnection2(existingNames) {
|
|
|
30404
30437
|
var seqAuth = createConnectionAuth({
|
|
30405
30438
|
load: loadConnections2,
|
|
30406
30439
|
save: saveConnections2,
|
|
30407
|
-
format: (c) => `${
|
|
30440
|
+
format: (c) => `${chalk213.bold(c.name)} ${c.url}`,
|
|
30408
30441
|
promptNew: promptConnection2,
|
|
30409
30442
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
30410
30443
|
});
|
|
30411
30444
|
|
|
30412
30445
|
// src/commands/seq/seqQuery.ts
|
|
30413
|
-
import
|
|
30446
|
+
import chalk217 from "chalk";
|
|
30414
30447
|
|
|
30415
30448
|
// src/commands/seq/fetchSeq.ts
|
|
30416
|
-
import
|
|
30417
|
-
async function fetchSeq(conn,
|
|
30418
|
-
const url = `${conn.url}${
|
|
30449
|
+
import chalk214 from "chalk";
|
|
30450
|
+
async function fetchSeq(conn, path90, params) {
|
|
30451
|
+
const url = `${conn.url}${path90}?${params}`;
|
|
30419
30452
|
const response = await fetch(url, {
|
|
30420
30453
|
headers: {
|
|
30421
30454
|
Accept: "application/json",
|
|
@@ -30424,7 +30457,7 @@ async function fetchSeq(conn, path88, params) {
|
|
|
30424
30457
|
});
|
|
30425
30458
|
if (!response.ok) {
|
|
30426
30459
|
const body = await response.text();
|
|
30427
|
-
console.error(
|
|
30460
|
+
console.error(chalk214.red(`Seq returned ${response.status}: ${body}`));
|
|
30428
30461
|
process.exit(1);
|
|
30429
30462
|
}
|
|
30430
30463
|
return response;
|
|
@@ -30483,23 +30516,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
30483
30516
|
}
|
|
30484
30517
|
|
|
30485
30518
|
// src/commands/seq/formatEvent.ts
|
|
30486
|
-
import
|
|
30519
|
+
import chalk215 from "chalk";
|
|
30487
30520
|
function levelColor(level) {
|
|
30488
30521
|
switch (level) {
|
|
30489
30522
|
case "Fatal":
|
|
30490
|
-
return
|
|
30523
|
+
return chalk215.bgRed.white;
|
|
30491
30524
|
case "Error":
|
|
30492
|
-
return
|
|
30525
|
+
return chalk215.red;
|
|
30493
30526
|
case "Warning":
|
|
30494
|
-
return
|
|
30527
|
+
return chalk215.yellow;
|
|
30495
30528
|
case "Information":
|
|
30496
|
-
return
|
|
30529
|
+
return chalk215.cyan;
|
|
30497
30530
|
case "Debug":
|
|
30498
|
-
return
|
|
30531
|
+
return chalk215.gray;
|
|
30499
30532
|
case "Verbose":
|
|
30500
|
-
return
|
|
30533
|
+
return chalk215.dim;
|
|
30501
30534
|
default:
|
|
30502
|
-
return
|
|
30535
|
+
return chalk215.white;
|
|
30503
30536
|
}
|
|
30504
30537
|
}
|
|
30505
30538
|
function levelAbbrev(level) {
|
|
@@ -30540,12 +30573,12 @@ function formatTimestamp(iso) {
|
|
|
30540
30573
|
function formatEvent(event) {
|
|
30541
30574
|
const color = levelColor(event.Level);
|
|
30542
30575
|
const abbrev = levelAbbrev(event.Level);
|
|
30543
|
-
const ts8 =
|
|
30576
|
+
const ts8 = chalk215.dim(formatTimestamp(event.Timestamp));
|
|
30544
30577
|
const msg = renderMessage(event);
|
|
30545
30578
|
const lines2 = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
30546
30579
|
if (event.Exception) {
|
|
30547
30580
|
for (const line of event.Exception.split("\n")) {
|
|
30548
|
-
lines2.push(
|
|
30581
|
+
lines2.push(chalk215.red(` ${line}`));
|
|
30549
30582
|
}
|
|
30550
30583
|
}
|
|
30551
30584
|
return lines2.join("\n");
|
|
@@ -30578,11 +30611,11 @@ function rejectTimestampFilter(filter) {
|
|
|
30578
30611
|
}
|
|
30579
30612
|
|
|
30580
30613
|
// src/shared/resolveNamedConnection.ts
|
|
30581
|
-
import
|
|
30614
|
+
import chalk216 from "chalk";
|
|
30582
30615
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
30583
30616
|
if (connections.length === 0) {
|
|
30584
30617
|
console.error(
|
|
30585
|
-
|
|
30618
|
+
chalk216.red(
|
|
30586
30619
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
30587
30620
|
)
|
|
30588
30621
|
);
|
|
@@ -30591,7 +30624,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
30591
30624
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
30592
30625
|
const connection = connections.find((c) => c.name === target);
|
|
30593
30626
|
if (!connection) {
|
|
30594
|
-
console.error(
|
|
30627
|
+
console.error(chalk216.red(`${kind} connection "${target}" not found.`));
|
|
30595
30628
|
process.exit(1);
|
|
30596
30629
|
}
|
|
30597
30630
|
return connection;
|
|
@@ -30620,7 +30653,7 @@ async function seqQuery(filter, options2) {
|
|
|
30620
30653
|
new URLSearchParams({ filter, count: String(count8) })
|
|
30621
30654
|
);
|
|
30622
30655
|
if (events.length === 0) {
|
|
30623
|
-
console.log(
|
|
30656
|
+
console.log(chalk217.yellow("No events found."));
|
|
30624
30657
|
return;
|
|
30625
30658
|
}
|
|
30626
30659
|
if (options2.json) {
|
|
@@ -30631,11 +30664,11 @@ async function seqQuery(filter, options2) {
|
|
|
30631
30664
|
for (const event of chronological) {
|
|
30632
30665
|
console.log(formatEvent(event));
|
|
30633
30666
|
}
|
|
30634
|
-
console.log(
|
|
30667
|
+
console.log(chalk217.dim(`
|
|
30635
30668
|
${events.length} events`));
|
|
30636
30669
|
if (events.length >= count8) {
|
|
30637
30670
|
console.log(
|
|
30638
|
-
|
|
30671
|
+
chalk217.yellow(
|
|
30639
30672
|
`Results limited to ${count8}. Use --count to retrieve more.`
|
|
30640
30673
|
)
|
|
30641
30674
|
);
|
|
@@ -30643,10 +30676,10 @@ ${events.length} events`));
|
|
|
30643
30676
|
}
|
|
30644
30677
|
|
|
30645
30678
|
// src/shared/setNamedDefaultConnection.ts
|
|
30646
|
-
import
|
|
30679
|
+
import chalk218 from "chalk";
|
|
30647
30680
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
30648
30681
|
if (!connections.find((c) => c.name === name)) {
|
|
30649
|
-
console.error(
|
|
30682
|
+
console.error(chalk218.red(`Connection "${name}" not found.`));
|
|
30650
30683
|
process.exit(1);
|
|
30651
30684
|
}
|
|
30652
30685
|
setDefault(name);
|
|
@@ -30695,7 +30728,7 @@ function registerSignal(program2) {
|
|
|
30695
30728
|
}
|
|
30696
30729
|
|
|
30697
30730
|
// src/commands/sql/sqlAuth.ts
|
|
30698
|
-
import
|
|
30731
|
+
import chalk220 from "chalk";
|
|
30699
30732
|
|
|
30700
30733
|
// src/commands/sql/loadConnections.ts
|
|
30701
30734
|
function loadConnections3() {
|
|
@@ -30724,7 +30757,7 @@ function setDefaultConnection2(name) {
|
|
|
30724
30757
|
}
|
|
30725
30758
|
|
|
30726
30759
|
// src/commands/sql/promptConnection.ts
|
|
30727
|
-
import
|
|
30760
|
+
import chalk219 from "chalk";
|
|
30728
30761
|
async function promptConnection3(existingNames) {
|
|
30729
30762
|
const name = await promptInput("name", "Connection name:", "default");
|
|
30730
30763
|
assertUniqueName(existingNames, name);
|
|
@@ -30732,7 +30765,7 @@ async function promptConnection3(existingNames) {
|
|
|
30732
30765
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
30733
30766
|
const port = Number.parseInt(portStr, 10);
|
|
30734
30767
|
if (!Number.isFinite(port)) {
|
|
30735
|
-
console.error(
|
|
30768
|
+
console.error(chalk219.red(`Invalid port "${portStr}".`));
|
|
30736
30769
|
process.exit(1);
|
|
30737
30770
|
}
|
|
30738
30771
|
const user = await promptInput("user", "User:");
|
|
@@ -30745,13 +30778,13 @@ async function promptConnection3(existingNames) {
|
|
|
30745
30778
|
var sqlAuth = createConnectionAuth({
|
|
30746
30779
|
load: loadConnections3,
|
|
30747
30780
|
save: saveConnections3,
|
|
30748
|
-
format: (c) => `${
|
|
30781
|
+
format: (c) => `${chalk220.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
30749
30782
|
promptNew: promptConnection3,
|
|
30750
30783
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
30751
30784
|
});
|
|
30752
30785
|
|
|
30753
30786
|
// src/commands/sql/printTable.ts
|
|
30754
|
-
import
|
|
30787
|
+
import chalk221 from "chalk";
|
|
30755
30788
|
function formatCell(value) {
|
|
30756
30789
|
if (value === null || value === void 0) return "";
|
|
30757
30790
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -30760,7 +30793,7 @@ function formatCell(value) {
|
|
|
30760
30793
|
}
|
|
30761
30794
|
function printTable(rows) {
|
|
30762
30795
|
if (rows.length === 0) {
|
|
30763
|
-
console.log(
|
|
30796
|
+
console.log(chalk221.yellow("(no rows)"));
|
|
30764
30797
|
return;
|
|
30765
30798
|
}
|
|
30766
30799
|
const columns = Object.keys(rows[0]);
|
|
@@ -30768,13 +30801,13 @@ function printTable(rows) {
|
|
|
30768
30801
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
30769
30802
|
);
|
|
30770
30803
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
30771
|
-
console.log(
|
|
30772
|
-
console.log(
|
|
30804
|
+
console.log(chalk221.dim(header));
|
|
30805
|
+
console.log(chalk221.dim("-".repeat(header.length)));
|
|
30773
30806
|
for (const row of rows) {
|
|
30774
30807
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
30775
30808
|
console.log(line);
|
|
30776
30809
|
}
|
|
30777
|
-
console.log(
|
|
30810
|
+
console.log(chalk221.dim(`
|
|
30778
30811
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
30779
30812
|
}
|
|
30780
30813
|
|
|
@@ -30834,7 +30867,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
30834
30867
|
}
|
|
30835
30868
|
|
|
30836
30869
|
// src/commands/sql/sqlMutate.ts
|
|
30837
|
-
import
|
|
30870
|
+
import chalk222 from "chalk";
|
|
30838
30871
|
|
|
30839
30872
|
// src/commands/sql/isMutation.ts
|
|
30840
30873
|
var MUTATION_KEYWORDS = [
|
|
@@ -30868,7 +30901,7 @@ function isMutation(sql25) {
|
|
|
30868
30901
|
async function sqlMutate(query, connectionName) {
|
|
30869
30902
|
if (!isMutation(query)) {
|
|
30870
30903
|
console.error(
|
|
30871
|
-
|
|
30904
|
+
chalk222.red(
|
|
30872
30905
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
30873
30906
|
)
|
|
30874
30907
|
);
|
|
@@ -30878,18 +30911,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
30878
30911
|
const pool = await sqlConnect(conn);
|
|
30879
30912
|
try {
|
|
30880
30913
|
const result = await pool.request().query(query);
|
|
30881
|
-
console.log(
|
|
30914
|
+
console.log(chalk222.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
30882
30915
|
} finally {
|
|
30883
30916
|
await pool.close();
|
|
30884
30917
|
}
|
|
30885
30918
|
}
|
|
30886
30919
|
|
|
30887
30920
|
// src/commands/sql/sqlQuery.ts
|
|
30888
|
-
import
|
|
30921
|
+
import chalk223 from "chalk";
|
|
30889
30922
|
async function sqlQuery(query, connectionName) {
|
|
30890
30923
|
if (isMutation(query)) {
|
|
30891
30924
|
console.error(
|
|
30892
|
-
|
|
30925
|
+
chalk223.red(
|
|
30893
30926
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
30894
30927
|
)
|
|
30895
30928
|
);
|
|
@@ -30904,7 +30937,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
30904
30937
|
printTable(rows);
|
|
30905
30938
|
} else {
|
|
30906
30939
|
console.log(
|
|
30907
|
-
|
|
30940
|
+
chalk223.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
30908
30941
|
);
|
|
30909
30942
|
}
|
|
30910
30943
|
} finally {
|
|
@@ -30967,15 +31000,15 @@ function registerSql(program2) {
|
|
|
30967
31000
|
// src/commands/sync.ts
|
|
30968
31001
|
import * as fs48 from "fs";
|
|
30969
31002
|
import * as os5 from "os";
|
|
30970
|
-
import * as
|
|
31003
|
+
import * as path84 from "path";
|
|
30971
31004
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
30972
31005
|
|
|
30973
31006
|
// src/commands/sync/pruneCommands.ts
|
|
30974
|
-
import * as
|
|
31007
|
+
import * as path75 from "path";
|
|
30975
31008
|
|
|
30976
31009
|
// src/commands/sync/pruneTarget.ts
|
|
30977
31010
|
import * as fs40 from "fs";
|
|
30978
|
-
import * as
|
|
31011
|
+
import * as path74 from "path";
|
|
30979
31012
|
function pruneTarget(targetDir, keepNames, shape, options2) {
|
|
30980
31013
|
const result = {
|
|
30981
31014
|
orphans: [],
|
|
@@ -30993,7 +31026,7 @@ function pruneTarget(targetDir, keepNames, shape, options2) {
|
|
|
30993
31026
|
}
|
|
30994
31027
|
if (keep.has(name)) continue;
|
|
30995
31028
|
result.orphans.push(entry.name);
|
|
30996
|
-
const entryPath =
|
|
31029
|
+
const entryPath = path74.join(targetDir, entry.name);
|
|
30997
31030
|
const reason4 = shape.blockedBy?.(entryPath);
|
|
30998
31031
|
if (reason4) {
|
|
30999
31032
|
result.skipped.push({ name: entry.name, reason: reason4 });
|
|
@@ -31013,7 +31046,7 @@ function pruneCommands(targetDir, commandNames, options2) {
|
|
|
31013
31046
|
targetDir,
|
|
31014
31047
|
commandNames,
|
|
31015
31048
|
{
|
|
31016
|
-
nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ?
|
|
31049
|
+
nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ? path75.basename(entry.name, ".md") : void 0
|
|
31017
31050
|
},
|
|
31018
31051
|
options2
|
|
31019
31052
|
);
|
|
@@ -31048,24 +31081,24 @@ function reportPrune(label2, result, force) {
|
|
|
31048
31081
|
|
|
31049
31082
|
// src/commands/sync/syncClaudeMd.ts
|
|
31050
31083
|
import * as fs41 from "fs";
|
|
31051
|
-
import * as
|
|
31052
|
-
import
|
|
31084
|
+
import * as path76 from "path";
|
|
31085
|
+
import chalk224 from "chalk";
|
|
31053
31086
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
31054
|
-
const source =
|
|
31055
|
-
const target =
|
|
31087
|
+
const source = path76.join(claudeDir, "CLAUDE.md");
|
|
31088
|
+
const target = path76.join(targetBase, "CLAUDE.md");
|
|
31056
31089
|
const sourceContent = fs41.readFileSync(source, "utf8");
|
|
31057
31090
|
if (fs41.existsSync(target)) {
|
|
31058
31091
|
const targetContent = fs41.readFileSync(target, "utf8");
|
|
31059
31092
|
if (sourceContent !== targetContent) {
|
|
31060
31093
|
console.log(
|
|
31061
|
-
|
|
31094
|
+
chalk224.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
31062
31095
|
);
|
|
31063
31096
|
console.log();
|
|
31064
31097
|
printDiff(targetContent, sourceContent);
|
|
31065
31098
|
if (!options2?.yes) {
|
|
31066
31099
|
printAutoConfirmHint();
|
|
31067
31100
|
const confirm = await promptConfirm(
|
|
31068
|
-
|
|
31101
|
+
chalk224.red("Overwrite existing CLAUDE.md?"),
|
|
31069
31102
|
false
|
|
31070
31103
|
);
|
|
31071
31104
|
if (!confirm) {
|
|
@@ -31080,13 +31113,13 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
31080
31113
|
}
|
|
31081
31114
|
|
|
31082
31115
|
// src/commands/sync/syncCodex.ts
|
|
31083
|
-
import * as
|
|
31116
|
+
import * as path79 from "path";
|
|
31084
31117
|
|
|
31085
31118
|
// src/commands/sync/installHarnessCommands.ts
|
|
31086
31119
|
import * as fs42 from "fs";
|
|
31087
|
-
import * as
|
|
31120
|
+
import * as path77 from "path";
|
|
31088
31121
|
function installHarnessCommands(claudeDir, harness, transform) {
|
|
31089
|
-
const commandsSource =
|
|
31122
|
+
const commandsSource = path77.join(claudeDir, "commands");
|
|
31090
31123
|
const files = fs42.readdirSync(commandsSource);
|
|
31091
31124
|
const names = [];
|
|
31092
31125
|
let synced = 0;
|
|
@@ -31094,15 +31127,15 @@ function installHarnessCommands(claudeDir, harness, transform) {
|
|
|
31094
31127
|
if (!file.endsWith(".md")) continue;
|
|
31095
31128
|
const name = file.replace(/\.md$/, "");
|
|
31096
31129
|
names.push(name);
|
|
31097
|
-
const content = fs42.readFileSync(
|
|
31098
|
-
const target =
|
|
31099
|
-
fs42.mkdirSync(
|
|
31130
|
+
const content = fs42.readFileSync(path77.join(commandsSource, file), "utf8");
|
|
31131
|
+
const target = path77.join(harness.homeDir, harness.sync.commandDest(name));
|
|
31132
|
+
fs42.mkdirSync(path77.dirname(target), { recursive: true });
|
|
31100
31133
|
fs42.writeFileSync(target, transform(name, content));
|
|
31101
31134
|
synced++;
|
|
31102
31135
|
}
|
|
31103
|
-
const agentsTarget =
|
|
31104
|
-
fs42.mkdirSync(
|
|
31105
|
-
fs42.copyFileSync(
|
|
31136
|
+
const agentsTarget = path77.join(harness.homeDir, harness.sync.agentsFile);
|
|
31137
|
+
fs42.mkdirSync(path77.dirname(agentsTarget), { recursive: true });
|
|
31138
|
+
fs42.copyFileSync(path77.join(claudeDir, "CLAUDE.md"), agentsTarget);
|
|
31106
31139
|
return { total: files.length, synced, names };
|
|
31107
31140
|
}
|
|
31108
31141
|
|
|
@@ -31128,7 +31161,7 @@ function unexpectedContent(skillDir) {
|
|
|
31128
31161
|
|
|
31129
31162
|
// src/commands/sync/syncCodexHooks.ts
|
|
31130
31163
|
import * as fs44 from "fs";
|
|
31131
|
-
import * as
|
|
31164
|
+
import * as path78 from "path";
|
|
31132
31165
|
var BEGIN = "# >>> assist codex hooks (managed) \u2014 do not edit >>>";
|
|
31133
31166
|
var END = "# <<< assist codex hooks (managed) <<<";
|
|
31134
31167
|
function upsertManagedBlock(existing, body) {
|
|
@@ -31159,9 +31192,9 @@ ${rest}
|
|
|
31159
31192
|
}
|
|
31160
31193
|
function syncCodexHooks(sourcePath) {
|
|
31161
31194
|
const body = fs44.readFileSync(sourcePath, "utf8");
|
|
31162
|
-
const configPath =
|
|
31195
|
+
const configPath = path78.join(harnesses.codex.homeDir, "config.toml");
|
|
31163
31196
|
const existing = fs44.existsSync(configPath) ? fs44.readFileSync(configPath, "utf8") : "";
|
|
31164
|
-
fs44.mkdirSync(
|
|
31197
|
+
fs44.mkdirSync(path78.dirname(configPath), { recursive: true });
|
|
31165
31198
|
fs44.writeFileSync(configPath, upsertManagedBlock(existing, body));
|
|
31166
31199
|
console.log(
|
|
31167
31200
|
"Registered assist codex-hook in ~/.codex/config.toml (UserPromptSubmit, PreToolUse, PostToolUse, PermissionRequest, Stop)"
|
|
@@ -31193,7 +31226,7 @@ function syncCodex(claudeDir, options2) {
|
|
|
31193
31226
|
harnesses.codex,
|
|
31194
31227
|
commandToSkill
|
|
31195
31228
|
);
|
|
31196
|
-
syncCodexHooks(
|
|
31229
|
+
syncCodexHooks(path79.join(claudeDir, "..", "codex", "config.toml"));
|
|
31197
31230
|
console.log(
|
|
31198
31231
|
`Synced ${total} skill(s) to ~/.codex/skills and CLAUDE.md to ~/.codex/AGENTS.md`
|
|
31199
31232
|
);
|
|
@@ -31201,42 +31234,42 @@ function syncCodex(claudeDir, options2) {
|
|
|
31201
31234
|
const force = options2.force ?? false;
|
|
31202
31235
|
reportPrune(
|
|
31203
31236
|
"~/.codex/skills",
|
|
31204
|
-
pruneSkills(
|
|
31237
|
+
pruneSkills(path79.join(harnesses.codex.homeDir, "skills"), names, { force }),
|
|
31205
31238
|
force
|
|
31206
31239
|
);
|
|
31207
31240
|
}
|
|
31208
31241
|
|
|
31209
31242
|
// src/commands/sync/syncDesign.ts
|
|
31210
31243
|
import * as fs45 from "fs";
|
|
31211
|
-
import * as
|
|
31244
|
+
import * as path80 from "path";
|
|
31212
31245
|
function syncDesign(claudeDir, targetBase) {
|
|
31213
|
-
const systemPromptSource =
|
|
31214
|
-
const systemPromptTarget =
|
|
31246
|
+
const systemPromptSource = path80.join(claudeDir, "design-system-prompt.md");
|
|
31247
|
+
const systemPromptTarget = path80.join(targetBase, "design-system-prompt.md");
|
|
31215
31248
|
fs45.copyFileSync(systemPromptSource, systemPromptTarget);
|
|
31216
31249
|
console.log(
|
|
31217
31250
|
"Copied design-system-prompt.md to ~/.claude/design-system-prompt.md"
|
|
31218
31251
|
);
|
|
31219
|
-
const skillsSource =
|
|
31220
|
-
const skillsTarget =
|
|
31252
|
+
const skillsSource = path80.join(claudeDir, "skills");
|
|
31253
|
+
const skillsTarget = path80.join(targetBase, "skills");
|
|
31221
31254
|
fs45.mkdirSync(skillsTarget, { recursive: true });
|
|
31222
31255
|
const files = fs45.readdirSync(skillsSource);
|
|
31223
31256
|
for (const file of files) {
|
|
31224
31257
|
fs45.copyFileSync(
|
|
31225
|
-
|
|
31226
|
-
|
|
31258
|
+
path80.join(skillsSource, file),
|
|
31259
|
+
path80.join(skillsTarget, file)
|
|
31227
31260
|
);
|
|
31228
31261
|
}
|
|
31229
31262
|
console.log(`Synced ${files.length} design skill(s) to ~/.claude/skills`);
|
|
31230
31263
|
}
|
|
31231
31264
|
|
|
31232
31265
|
// src/commands/sync/syncPi.ts
|
|
31233
|
-
import * as
|
|
31266
|
+
import * as path82 from "path";
|
|
31234
31267
|
|
|
31235
31268
|
// src/commands/sync/syncPiHooks.ts
|
|
31236
31269
|
import * as fs46 from "fs";
|
|
31237
|
-
import * as
|
|
31270
|
+
import * as path81 from "path";
|
|
31238
31271
|
function piExtensionsDir() {
|
|
31239
|
-
return
|
|
31272
|
+
return path81.join(harnesses.pi.homeDir, "extensions");
|
|
31240
31273
|
}
|
|
31241
31274
|
function syncPiHooks(sourceDir) {
|
|
31242
31275
|
const target = piExtensionsDir();
|
|
@@ -31244,8 +31277,8 @@ function syncPiHooks(sourceDir) {
|
|
|
31244
31277
|
const files = fs46.readdirSync(sourceDir).filter((f) => f.endsWith(".ts"));
|
|
31245
31278
|
for (const file of files) {
|
|
31246
31279
|
fs46.copyFileSync(
|
|
31247
|
-
|
|
31248
|
-
|
|
31280
|
+
path81.join(sourceDir, file),
|
|
31281
|
+
path81.join(target, `assist-${file}`)
|
|
31249
31282
|
);
|
|
31250
31283
|
}
|
|
31251
31284
|
console.log(
|
|
@@ -31282,7 +31315,7 @@ function syncPi(claudeDir, options2) {
|
|
|
31282
31315
|
harnesses.pi,
|
|
31283
31316
|
commandToPrompt
|
|
31284
31317
|
);
|
|
31285
|
-
syncPiHooks(
|
|
31318
|
+
syncPiHooks(path82.join(claudeDir, "..", "pi"));
|
|
31286
31319
|
console.log(
|
|
31287
31320
|
`Synced ${synced} prompt(s) to ~/.pi/agent/prompts and CLAUDE.md to ~/.pi/agent/AGENTS.md`
|
|
31288
31321
|
);
|
|
@@ -31290,18 +31323,18 @@ function syncPi(claudeDir, options2) {
|
|
|
31290
31323
|
const force = options2.force ?? false;
|
|
31291
31324
|
reportPrune(
|
|
31292
31325
|
"~/.pi/agent/prompts",
|
|
31293
|
-
pruneCommands(
|
|
31326
|
+
pruneCommands(path82.join(harnesses.pi.homeDir, "prompts"), names, { force }),
|
|
31294
31327
|
force
|
|
31295
31328
|
);
|
|
31296
31329
|
}
|
|
31297
31330
|
|
|
31298
31331
|
// src/commands/sync/syncSettings.ts
|
|
31299
31332
|
import * as fs47 from "fs";
|
|
31300
|
-
import * as
|
|
31301
|
-
import
|
|
31333
|
+
import * as path83 from "path";
|
|
31334
|
+
import chalk225 from "chalk";
|
|
31302
31335
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
31303
|
-
const source =
|
|
31304
|
-
const target =
|
|
31336
|
+
const source = path83.join(claudeDir, "settings.json");
|
|
31337
|
+
const target = path83.join(targetBase, "settings.json");
|
|
31305
31338
|
const sourceContent = fs47.readFileSync(source, "utf8");
|
|
31306
31339
|
const sourceSettings = JSON.parse(sourceContent);
|
|
31307
31340
|
const targetExists = fs47.existsSync(target);
|
|
@@ -31317,7 +31350,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
31317
31350
|
if (mergedContent !== normalizedTarget) {
|
|
31318
31351
|
if (!options2?.yes) {
|
|
31319
31352
|
console.log(
|
|
31320
|
-
|
|
31353
|
+
chalk225.yellow(
|
|
31321
31354
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
31322
31355
|
)
|
|
31323
31356
|
);
|
|
@@ -31325,7 +31358,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
31325
31358
|
printDiff(targetContent, mergedContent);
|
|
31326
31359
|
printAutoConfirmHint();
|
|
31327
31360
|
const confirm = await promptConfirm(
|
|
31328
|
-
|
|
31361
|
+
chalk225.red("Overwrite existing settings.json?"),
|
|
31329
31362
|
false
|
|
31330
31363
|
);
|
|
31331
31364
|
if (!confirm) {
|
|
@@ -31341,13 +31374,13 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
31341
31374
|
|
|
31342
31375
|
// src/commands/sync.ts
|
|
31343
31376
|
var __filename4 = fileURLToPath8(import.meta.url);
|
|
31344
|
-
var __dirname5 =
|
|
31377
|
+
var __dirname5 = path84.dirname(__filename4);
|
|
31345
31378
|
async function sync(options2) {
|
|
31346
31379
|
const config = loadConfig();
|
|
31347
31380
|
const yes = options2?.yes ?? config.sync.autoConfirm;
|
|
31348
31381
|
const prune = { prune: options2?.prune, force: options2?.force };
|
|
31349
|
-
const claudeDir =
|
|
31350
|
-
const targetBase =
|
|
31382
|
+
const claudeDir = path84.join(__dirname5, "..", "claude");
|
|
31383
|
+
const targetBase = path84.join(os5.homedir(), ".claude");
|
|
31351
31384
|
const commandFiles = syncCommands(claudeDir, targetBase);
|
|
31352
31385
|
syncDesign(claudeDir, targetBase);
|
|
31353
31386
|
await syncSettings(claudeDir, targetBase, { yes });
|
|
@@ -31355,21 +31388,21 @@ async function sync(options2) {
|
|
|
31355
31388
|
syncCodex(claudeDir, prune);
|
|
31356
31389
|
syncPi(claudeDir, prune);
|
|
31357
31390
|
if (!options2?.prune) return;
|
|
31358
|
-
const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) =>
|
|
31391
|
+
const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) => path84.basename(file, ".md"));
|
|
31359
31392
|
const force = options2.force ?? false;
|
|
31360
31393
|
reportPrune(
|
|
31361
31394
|
"~/.claude/commands",
|
|
31362
|
-
pruneCommands(
|
|
31395
|
+
pruneCommands(path84.join(targetBase, "commands"), commandNames, { force }),
|
|
31363
31396
|
force
|
|
31364
31397
|
);
|
|
31365
31398
|
}
|
|
31366
31399
|
function syncCommands(claudeDir, targetBase) {
|
|
31367
|
-
const sourceDir =
|
|
31368
|
-
const targetDir =
|
|
31400
|
+
const sourceDir = path84.join(claudeDir, "commands");
|
|
31401
|
+
const targetDir = path84.join(targetBase, "commands");
|
|
31369
31402
|
fs48.mkdirSync(targetDir, { recursive: true });
|
|
31370
31403
|
const files = fs48.readdirSync(sourceDir);
|
|
31371
31404
|
for (const file of files) {
|
|
31372
|
-
fs48.copyFileSync(
|
|
31405
|
+
fs48.copyFileSync(path84.join(sourceDir, file), path84.join(targetDir, file));
|
|
31373
31406
|
console.log(`Copied ${file} to ${targetDir}`);
|
|
31374
31407
|
}
|
|
31375
31408
|
console.log(`Synced ${files.length} command(s) to ~/.claude/commands`);
|
|
@@ -31397,7 +31430,7 @@ function registerSync(program2) {
|
|
|
31397
31430
|
}
|
|
31398
31431
|
|
|
31399
31432
|
// src/commands/transcript/clean.ts
|
|
31400
|
-
import { existsSync as
|
|
31433
|
+
import { existsSync as existsSync71 } from "fs";
|
|
31401
31434
|
|
|
31402
31435
|
// src/commands/transcript/cleanText.ts
|
|
31403
31436
|
function cleanText(text18) {
|
|
@@ -31621,9 +31654,9 @@ function formatVtt(cues) {
|
|
|
31621
31654
|
}
|
|
31622
31655
|
|
|
31623
31656
|
// src/commands/transcript/convert/readCleanedCues.ts
|
|
31624
|
-
import { readFileSync as
|
|
31657
|
+
import { readFileSync as readFileSync55 } from "fs";
|
|
31625
31658
|
function readCleanedCues(inputPath) {
|
|
31626
|
-
return deduplicateCues(parseVtt(
|
|
31659
|
+
return deduplicateCues(parseVtt(readFileSync55(inputPath, "utf8")));
|
|
31627
31660
|
}
|
|
31628
31661
|
|
|
31629
31662
|
// src/commands/transcript/clean.ts
|
|
@@ -31642,7 +31675,7 @@ function clean(file, options2 = {}) {
|
|
|
31642
31675
|
);
|
|
31643
31676
|
process.exit(1);
|
|
31644
31677
|
}
|
|
31645
|
-
if (!
|
|
31678
|
+
if (!existsSync71(file)) {
|
|
31646
31679
|
console.error(`Error: VTT file not found: ${file}`);
|
|
31647
31680
|
process.exit(1);
|
|
31648
31681
|
}
|
|
@@ -31725,11 +31758,11 @@ async function configure() {
|
|
|
31725
31758
|
}
|
|
31726
31759
|
|
|
31727
31760
|
// src/commands/transcript/list.ts
|
|
31728
|
-
import { existsSync as
|
|
31761
|
+
import { existsSync as existsSync72, readdirSync as readdirSync20, statSync as statSync11 } from "fs";
|
|
31729
31762
|
import { join as join83 } from "path";
|
|
31730
31763
|
function list4() {
|
|
31731
31764
|
const { vttDir } = getTranscriptConfig();
|
|
31732
|
-
if (!
|
|
31765
|
+
if (!existsSync72(vttDir)) return;
|
|
31733
31766
|
for (const entry of readdirSync20(vttDir)) {
|
|
31734
31767
|
if (!entry.endsWith(".vtt")) continue;
|
|
31735
31768
|
if (statSync11(join83(vttDir, entry)).isDirectory()) continue;
|
|
@@ -31738,7 +31771,7 @@ function list4() {
|
|
|
31738
31771
|
}
|
|
31739
31772
|
|
|
31740
31773
|
// src/commands/transcript/move.ts
|
|
31741
|
-
import { existsSync as
|
|
31774
|
+
import { existsSync as existsSync73, mkdirSync as mkdirSync27, renameSync as renameSync2, writeFileSync as writeFileSync45 } from "fs";
|
|
31742
31775
|
import { basename as basename21, join as join84 } from "path";
|
|
31743
31776
|
|
|
31744
31777
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
@@ -31762,7 +31795,7 @@ function move(file, options2) {
|
|
|
31762
31795
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
31763
31796
|
const filename = basename21(file);
|
|
31764
31797
|
const sourcePath = join84(vttDir, filename);
|
|
31765
|
-
if (!
|
|
31798
|
+
if (!existsSync73(sourcePath)) {
|
|
31766
31799
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
31767
31800
|
process.exit(1);
|
|
31768
31801
|
}
|
|
@@ -31771,7 +31804,7 @@ function move(file, options2) {
|
|
|
31771
31804
|
const formattedDir = join84(transcriptsDir, client);
|
|
31772
31805
|
mkdirSync27(formattedDir, { recursive: true });
|
|
31773
31806
|
const formattedPath = join84(formattedDir, outputName);
|
|
31774
|
-
|
|
31807
|
+
writeFileSync45(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
31775
31808
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
31776
31809
|
const summaryPath = join84(summaryDir, client, outputName);
|
|
31777
31810
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
@@ -31892,14 +31925,14 @@ function devices() {
|
|
|
31892
31925
|
}
|
|
31893
31926
|
|
|
31894
31927
|
// src/commands/voice/logs.ts
|
|
31895
|
-
import { existsSync as
|
|
31928
|
+
import { existsSync as existsSync74, readFileSync as readFileSync56 } from "fs";
|
|
31896
31929
|
function logs(options2) {
|
|
31897
|
-
if (!
|
|
31930
|
+
if (!existsSync74(voicePaths.log)) {
|
|
31898
31931
|
console.log("No voice log file found");
|
|
31899
31932
|
return;
|
|
31900
31933
|
}
|
|
31901
31934
|
const count8 = Number.parseInt(options2.lines ?? "150", 10);
|
|
31902
|
-
const content =
|
|
31935
|
+
const content = readFileSync56(voicePaths.log, "utf8").trim();
|
|
31903
31936
|
if (!content) {
|
|
31904
31937
|
console.log("Voice log is empty");
|
|
31905
31938
|
return;
|
|
@@ -31926,7 +31959,7 @@ import { join as join88 } from "path";
|
|
|
31926
31959
|
|
|
31927
31960
|
// src/commands/voice/checkLockFile.ts
|
|
31928
31961
|
import { execSync as execSync58 } from "child_process";
|
|
31929
|
-
import { existsSync as
|
|
31962
|
+
import { existsSync as existsSync75, mkdirSync as mkdirSync28, readFileSync as readFileSync57, writeFileSync as writeFileSync46 } from "fs";
|
|
31930
31963
|
import { join as join87 } from "path";
|
|
31931
31964
|
function isProcessAlive2(pid) {
|
|
31932
31965
|
try {
|
|
@@ -31938,9 +31971,9 @@ function isProcessAlive2(pid) {
|
|
|
31938
31971
|
}
|
|
31939
31972
|
function checkLockFile() {
|
|
31940
31973
|
const lockFile = getLockFile();
|
|
31941
|
-
if (!
|
|
31974
|
+
if (!existsSync75(lockFile)) return;
|
|
31942
31975
|
try {
|
|
31943
|
-
const lock2 = JSON.parse(
|
|
31976
|
+
const lock2 = JSON.parse(readFileSync57(lockFile, "utf8"));
|
|
31944
31977
|
if (lock2.pid && isProcessAlive2(lock2.pid)) {
|
|
31945
31978
|
console.error(
|
|
31946
31979
|
`Voice daemon already running (PID ${lock2.pid}, env: ${lock2.env}). Stop it first with: assist voice stop`
|
|
@@ -31951,7 +31984,7 @@ function checkLockFile() {
|
|
|
31951
31984
|
}
|
|
31952
31985
|
}
|
|
31953
31986
|
function bootstrapVenv() {
|
|
31954
|
-
if (
|
|
31987
|
+
if (existsSync75(getVenvPython())) return;
|
|
31955
31988
|
console.log("Setting up Python environment...");
|
|
31956
31989
|
const pythonDir = getPythonDir();
|
|
31957
31990
|
execSync58(
|
|
@@ -31965,7 +31998,7 @@ function bootstrapVenv() {
|
|
|
31965
31998
|
function writeLockFile(pid) {
|
|
31966
31999
|
const lockFile = getLockFile();
|
|
31967
32000
|
mkdirSync28(join87(lockFile, ".."), { recursive: true });
|
|
31968
|
-
|
|
32001
|
+
writeFileSync46(
|
|
31969
32002
|
lockFile,
|
|
31970
32003
|
JSON.stringify({
|
|
31971
32004
|
pid,
|
|
@@ -31993,7 +32026,7 @@ function setup() {
|
|
|
31993
32026
|
|
|
31994
32027
|
// src/commands/voice/start.ts
|
|
31995
32028
|
import { spawn as spawn8 } from "child_process";
|
|
31996
|
-
import { mkdirSync as mkdirSync30, writeFileSync as
|
|
32029
|
+
import { mkdirSync as mkdirSync30, writeFileSync as writeFileSync47 } from "fs";
|
|
31997
32030
|
import { join as join89 } from "path";
|
|
31998
32031
|
|
|
31999
32032
|
// src/commands/voice/buildDaemonEnv.ts
|
|
@@ -32022,7 +32055,7 @@ function spawnBackground(python, script, env) {
|
|
|
32022
32055
|
console.error("Failed to start voice daemon");
|
|
32023
32056
|
process.exit(1);
|
|
32024
32057
|
}
|
|
32025
|
-
|
|
32058
|
+
writeFileSync47(voicePaths.pid, String(pid));
|
|
32026
32059
|
writeLockFile(pid);
|
|
32027
32060
|
console.log(`Voice daemon started (PID ${pid})`);
|
|
32028
32061
|
}
|
|
@@ -32042,7 +32075,7 @@ function start2(options2) {
|
|
|
32042
32075
|
}
|
|
32043
32076
|
|
|
32044
32077
|
// src/commands/voice/status.ts
|
|
32045
|
-
import { existsSync as
|
|
32078
|
+
import { existsSync as existsSync76, readFileSync as readFileSync58 } from "fs";
|
|
32046
32079
|
function isProcessAlive3(pid) {
|
|
32047
32080
|
try {
|
|
32048
32081
|
process.kill(pid, 0);
|
|
@@ -32052,16 +32085,16 @@ function isProcessAlive3(pid) {
|
|
|
32052
32085
|
}
|
|
32053
32086
|
}
|
|
32054
32087
|
function readRecentLogs(count8) {
|
|
32055
|
-
if (!
|
|
32056
|
-
const lines2 =
|
|
32088
|
+
if (!existsSync76(voicePaths.log)) return [];
|
|
32089
|
+
const lines2 = readFileSync58(voicePaths.log, "utf8").trim().split("\n");
|
|
32057
32090
|
return lines2.slice(-count8);
|
|
32058
32091
|
}
|
|
32059
32092
|
function status2() {
|
|
32060
|
-
if (!
|
|
32093
|
+
if (!existsSync76(voicePaths.pid)) {
|
|
32061
32094
|
console.log("Voice daemon: not running (no PID file)");
|
|
32062
32095
|
return;
|
|
32063
32096
|
}
|
|
32064
|
-
const pid = Number.parseInt(
|
|
32097
|
+
const pid = Number.parseInt(readFileSync58(voicePaths.pid, "utf8").trim(), 10);
|
|
32065
32098
|
const alive = isProcessAlive3(pid);
|
|
32066
32099
|
console.log(`Voice daemon: ${alive ? "running" : "dead"} (PID ${pid})`);
|
|
32067
32100
|
const recent = readRecentLogs(5);
|
|
@@ -32080,13 +32113,13 @@ function status2() {
|
|
|
32080
32113
|
}
|
|
32081
32114
|
|
|
32082
32115
|
// src/commands/voice/stop.ts
|
|
32083
|
-
import { existsSync as
|
|
32116
|
+
import { existsSync as existsSync77, readFileSync as readFileSync59, unlinkSync as unlinkSync20 } from "fs";
|
|
32084
32117
|
function stop2() {
|
|
32085
|
-
if (!
|
|
32118
|
+
if (!existsSync77(voicePaths.pid)) {
|
|
32086
32119
|
console.log("Voice daemon is not running (no PID file)");
|
|
32087
32120
|
return;
|
|
32088
32121
|
}
|
|
32089
|
-
const pid = Number.parseInt(
|
|
32122
|
+
const pid = Number.parseInt(readFileSync59(voicePaths.pid, "utf8").trim(), 10);
|
|
32090
32123
|
try {
|
|
32091
32124
|
process.kill(pid, "SIGTERM");
|
|
32092
32125
|
console.log(`Sent SIGTERM to voice daemon (PID ${pid})`);
|
|
@@ -32099,7 +32132,7 @@ function stop2() {
|
|
|
32099
32132
|
}
|
|
32100
32133
|
try {
|
|
32101
32134
|
const lockFile = getLockFile();
|
|
32102
|
-
if (
|
|
32135
|
+
if (existsSync77(lockFile)) unlinkSync20(lockFile);
|
|
32103
32136
|
} catch {
|
|
32104
32137
|
}
|
|
32105
32138
|
console.log("Voice daemon stopped");
|
|
@@ -32224,11 +32257,11 @@ var webUiPrefix = "src/commands/sessions/web/ui/";
|
|
|
32224
32257
|
var sessionsPrefix = "src/commands/sessions/";
|
|
32225
32258
|
var rules = [
|
|
32226
32259
|
{
|
|
32227
|
-
matches: (
|
|
32260
|
+
matches: (path90) => path90.startsWith(webUiPrefix),
|
|
32228
32261
|
advice: "restart the web server, then hard-reload the browser tab"
|
|
32229
32262
|
},
|
|
32230
32263
|
{
|
|
32231
|
-
matches: (
|
|
32264
|
+
matches: (path90) => path90.startsWith(sessionsPrefix) && !path90.startsWith(webUiPrefix),
|
|
32232
32265
|
advice: "restart the daemon"
|
|
32233
32266
|
}
|
|
32234
32267
|
];
|
|
@@ -32239,31 +32272,31 @@ function restartAdvice(paths) {
|
|
|
32239
32272
|
// src/commands/watch/syncAdvice.ts
|
|
32240
32273
|
var rules2 = [
|
|
32241
32274
|
{
|
|
32242
|
-
matches: (
|
|
32275
|
+
matches: (path90) => path90.startsWith("claude/commands/"),
|
|
32243
32276
|
reason: "claude/commands changed"
|
|
32244
32277
|
},
|
|
32245
32278
|
{
|
|
32246
|
-
matches: (
|
|
32279
|
+
matches: (path90) => path90.startsWith("claude/skills/"),
|
|
32247
32280
|
reason: "claude/skills changed"
|
|
32248
32281
|
},
|
|
32249
32282
|
{
|
|
32250
|
-
matches: (
|
|
32283
|
+
matches: (path90) => path90 === "claude/settings.json",
|
|
32251
32284
|
reason: "claude/settings.json changed"
|
|
32252
32285
|
},
|
|
32253
32286
|
{
|
|
32254
|
-
matches: (
|
|
32287
|
+
matches: (path90) => path90 === "claude/CLAUDE.md",
|
|
32255
32288
|
reason: "claude/CLAUDE.md changed"
|
|
32256
32289
|
},
|
|
32257
32290
|
{
|
|
32258
|
-
matches: (
|
|
32291
|
+
matches: (path90) => path90 === "claude/design-system-prompt.md",
|
|
32259
32292
|
reason: "claude/design-system-prompt.md changed"
|
|
32260
32293
|
},
|
|
32261
32294
|
{
|
|
32262
|
-
matches: (
|
|
32295
|
+
matches: (path90) => path90.startsWith("codex/"),
|
|
32263
32296
|
reason: "codex sources changed"
|
|
32264
32297
|
},
|
|
32265
32298
|
{
|
|
32266
|
-
matches: (
|
|
32299
|
+
matches: (path90) => path90.startsWith("pi/"),
|
|
32267
32300
|
reason: "pi sources changed"
|
|
32268
32301
|
}
|
|
32269
32302
|
];
|
|
@@ -32504,7 +32537,7 @@ function resolveParams(params, cliArgs) {
|
|
|
32504
32537
|
}
|
|
32505
32538
|
|
|
32506
32539
|
// src/commands/run/resolveRunCwd.ts
|
|
32507
|
-
import { existsSync as
|
|
32540
|
+
import { existsSync as existsSync78 } from "fs";
|
|
32508
32541
|
import { resolve as resolve19 } from "path";
|
|
32509
32542
|
var MissingRunCwdError = class extends Error {
|
|
32510
32543
|
constructor(runName, cwd) {
|
|
@@ -32517,17 +32550,17 @@ var MissingRunCwdError = class extends Error {
|
|
|
32517
32550
|
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
32518
32551
|
if (!config.cwd) return void 0;
|
|
32519
32552
|
const cwd = resolve19(baseDir, config.cwd);
|
|
32520
|
-
if (!
|
|
32553
|
+
if (!existsSync78(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
32521
32554
|
return cwd;
|
|
32522
32555
|
}
|
|
32523
32556
|
|
|
32524
32557
|
// src/commands/run/runCommandToCompletion.ts
|
|
32525
32558
|
import { spawn as spawn9 } from "child_process";
|
|
32526
|
-
import { existsSync as
|
|
32559
|
+
import { existsSync as existsSync80 } from "fs";
|
|
32527
32560
|
|
|
32528
32561
|
// src/commands/run/resolveCommand.ts
|
|
32529
32562
|
import { execFileSync as execFileSync16 } from "child_process";
|
|
32530
|
-
import { existsSync as
|
|
32563
|
+
import { existsSync as existsSync79 } from "fs";
|
|
32531
32564
|
import { dirname as dirname37, join as join91, resolve as resolve20 } from "path";
|
|
32532
32565
|
function resolveCommand2(command) {
|
|
32533
32566
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
@@ -32535,7 +32568,7 @@ function resolveCommand2(command) {
|
|
|
32535
32568
|
const gitPath = execFileSync16("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
32536
32569
|
const gitRoot = resolve20(dirname37(gitPath), "..");
|
|
32537
32570
|
const gitBash = join91(gitRoot, "bin", "bash.exe");
|
|
32538
|
-
if (
|
|
32571
|
+
if (existsSync79(gitBash)) return gitBash;
|
|
32539
32572
|
} catch {
|
|
32540
32573
|
return command;
|
|
32541
32574
|
}
|
|
@@ -32545,7 +32578,7 @@ function resolveCommand2(command) {
|
|
|
32545
32578
|
// src/commands/run/runCommandToCompletion.ts
|
|
32546
32579
|
function runCommandToCompletion(command, args, env, cwd, quiet) {
|
|
32547
32580
|
return new Promise((resolveResult) => {
|
|
32548
|
-
if (cwd && !
|
|
32581
|
+
if (cwd && !existsSync80(cwd)) {
|
|
32549
32582
|
resolveResult({
|
|
32550
32583
|
kind: "failed",
|
|
32551
32584
|
message: `Failed to execute command: cwd ${cwd} does not exist`
|
|
@@ -32802,7 +32835,7 @@ function registerWatch(program2) {
|
|
|
32802
32835
|
|
|
32803
32836
|
// src/commands/roam/auth.ts
|
|
32804
32837
|
import { randomBytes } from "crypto";
|
|
32805
|
-
import
|
|
32838
|
+
import chalk226 from "chalk";
|
|
32806
32839
|
|
|
32807
32840
|
// src/commands/roam/waitForCallback.ts
|
|
32808
32841
|
import { createServer as createServer3 } from "http";
|
|
@@ -32933,13 +32966,13 @@ async function auth() {
|
|
|
32933
32966
|
saveGlobalConfig(config);
|
|
32934
32967
|
const state = randomBytes(16).toString("hex");
|
|
32935
32968
|
console.log(
|
|
32936
|
-
|
|
32969
|
+
chalk226.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
32937
32970
|
);
|
|
32938
|
-
console.log(
|
|
32939
|
-
console.log(
|
|
32940
|
-
console.log(
|
|
32971
|
+
console.log(chalk226.white("http://localhost:14523/callback\n"));
|
|
32972
|
+
console.log(chalk226.blue("Opening browser for authorization..."));
|
|
32973
|
+
console.log(chalk226.dim("Waiting for authorization callback..."));
|
|
32941
32974
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
32942
|
-
console.log(
|
|
32975
|
+
console.log(chalk226.dim("Exchanging code for tokens..."));
|
|
32943
32976
|
const tokens = await exchangeToken({
|
|
32944
32977
|
code,
|
|
32945
32978
|
clientId,
|
|
@@ -32955,13 +32988,13 @@ async function auth() {
|
|
|
32955
32988
|
};
|
|
32956
32989
|
saveGlobalConfig(config);
|
|
32957
32990
|
console.log(
|
|
32958
|
-
|
|
32991
|
+
chalk226.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
32959
32992
|
);
|
|
32960
32993
|
}
|
|
32961
32994
|
|
|
32962
32995
|
// src/commands/roam/postRoamActivity.ts
|
|
32963
32996
|
import { execFileSync as execFileSync18 } from "child_process";
|
|
32964
|
-
import { readdirSync as readdirSync21, readFileSync as
|
|
32997
|
+
import { readdirSync as readdirSync21, readFileSync as readFileSync60, statSync as statSync12 } from "fs";
|
|
32965
32998
|
import { join as join92 } from "path";
|
|
32966
32999
|
function findPortFile(roamDir) {
|
|
32967
33000
|
let entries;
|
|
@@ -32971,9 +33004,9 @@ function findPortFile(roamDir) {
|
|
|
32971
33004
|
return void 0;
|
|
32972
33005
|
}
|
|
32973
33006
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
32974
|
-
const
|
|
33007
|
+
const path90 = join92(roamDir, name);
|
|
32975
33008
|
try {
|
|
32976
|
-
return { path:
|
|
33009
|
+
return { path: path90, mtimeMs: statSync12(path90).mtimeMs };
|
|
32977
33010
|
} catch {
|
|
32978
33011
|
return void 0;
|
|
32979
33012
|
}
|
|
@@ -32987,7 +33020,7 @@ function postRoamActivity(app, event) {
|
|
|
32987
33020
|
if (!portFile) return;
|
|
32988
33021
|
let port;
|
|
32989
33022
|
try {
|
|
32990
|
-
port =
|
|
33023
|
+
port = readFileSync60(portFile, "utf8").trim();
|
|
32991
33024
|
} catch {
|
|
32992
33025
|
return;
|
|
32993
33026
|
}
|
|
@@ -33115,7 +33148,7 @@ async function run3(name, args) {
|
|
|
33115
33148
|
}
|
|
33116
33149
|
|
|
33117
33150
|
// src/commands/run/add.ts
|
|
33118
|
-
import { mkdirSync as mkdirSync31, writeFileSync as
|
|
33151
|
+
import { mkdirSync as mkdirSync31, writeFileSync as writeFileSync48 } from "fs";
|
|
33119
33152
|
import { join as join93 } from "path";
|
|
33120
33153
|
|
|
33121
33154
|
// src/commands/run/extractOption.ts
|
|
@@ -33186,7 +33219,7 @@ description: Run ${name}
|
|
|
33186
33219
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
33187
33220
|
`;
|
|
33188
33221
|
const filePath = join93(dir, `${name}.md`);
|
|
33189
|
-
|
|
33222
|
+
writeFileSync48(filePath, content);
|
|
33190
33223
|
console.log(`Created command file: ${filePath}`);
|
|
33191
33224
|
}
|
|
33192
33225
|
function add3() {
|
|
@@ -33209,11 +33242,11 @@ function findLinkIndex() {
|
|
|
33209
33242
|
function parseLinkArgs() {
|
|
33210
33243
|
const idx = findLinkIndex();
|
|
33211
33244
|
if (idx === -1) return null;
|
|
33212
|
-
const
|
|
33245
|
+
const path90 = process.argv[idx + 1];
|
|
33213
33246
|
const rest = process.argv.slice(idx + 2);
|
|
33214
33247
|
const { value: prefix2 } = extractOption(rest, "--prefix");
|
|
33215
33248
|
if (!prefix2) return null;
|
|
33216
|
-
return { path:
|
|
33249
|
+
return { path: path90, prefix: prefix2 };
|
|
33217
33250
|
}
|
|
33218
33251
|
function hasDuplicateLink(runList, linkPath) {
|
|
33219
33252
|
return runList.some(
|
|
@@ -33241,7 +33274,7 @@ function link2() {
|
|
|
33241
33274
|
}
|
|
33242
33275
|
|
|
33243
33276
|
// src/commands/run/remove.ts
|
|
33244
|
-
import { existsSync as
|
|
33277
|
+
import { existsSync as existsSync81, unlinkSync as unlinkSync21 } from "fs";
|
|
33245
33278
|
import { join as join94 } from "path";
|
|
33246
33279
|
function findRemoveIndex() {
|
|
33247
33280
|
const idx = process.argv.indexOf("remove");
|
|
@@ -33258,7 +33291,7 @@ function parseRemoveName() {
|
|
|
33258
33291
|
}
|
|
33259
33292
|
function deleteCommandFile(name) {
|
|
33260
33293
|
const filePath = join94(".claude", "commands", `${name}.md`);
|
|
33261
|
-
if (
|
|
33294
|
+
if (existsSync81(filePath)) {
|
|
33262
33295
|
unlinkSync21(filePath);
|
|
33263
33296
|
console.log(`Deleted command file: ${filePath}`);
|
|
33264
33297
|
}
|
|
@@ -33303,10 +33336,10 @@ function registerRun(program2) {
|
|
|
33303
33336
|
|
|
33304
33337
|
// src/commands/screenshot/index.ts
|
|
33305
33338
|
import { execSync as execSync60 } from "child_process";
|
|
33306
|
-
import { existsSync as
|
|
33339
|
+
import { existsSync as existsSync82, mkdirSync as mkdirSync32, unlinkSync as unlinkSync22, writeFileSync as writeFileSync49 } from "fs";
|
|
33307
33340
|
import { tmpdir as tmpdir9 } from "os";
|
|
33308
33341
|
import { join as join95, resolve as resolve21 } from "path";
|
|
33309
|
-
import
|
|
33342
|
+
import chalk227 from "chalk";
|
|
33310
33343
|
|
|
33311
33344
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
33312
33345
|
var captureWindowPs1 = `
|
|
@@ -33435,7 +33468,7 @@ Write-Output $OutputPath
|
|
|
33435
33468
|
|
|
33436
33469
|
// src/commands/screenshot/index.ts
|
|
33437
33470
|
function buildOutputPath(outputDir, processName) {
|
|
33438
|
-
if (!
|
|
33471
|
+
if (!existsSync82(outputDir)) {
|
|
33439
33472
|
mkdirSync32(outputDir, { recursive: true });
|
|
33440
33473
|
}
|
|
33441
33474
|
const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
@@ -33443,7 +33476,7 @@ function buildOutputPath(outputDir, processName) {
|
|
|
33443
33476
|
}
|
|
33444
33477
|
function runPowerShellScript(processName, outputPath) {
|
|
33445
33478
|
const scriptPath = join95(tmpdir9(), `assist-screenshot-${Date.now()}.ps1`);
|
|
33446
|
-
|
|
33479
|
+
writeFileSync49(scriptPath, captureWindowPs1, "utf8");
|
|
33447
33480
|
try {
|
|
33448
33481
|
execSync60(
|
|
33449
33482
|
`powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
|
|
@@ -33457,13 +33490,13 @@ function screenshot(processName) {
|
|
|
33457
33490
|
const config = loadConfig();
|
|
33458
33491
|
const outputDir = resolve21(config.screenshot.outputDir);
|
|
33459
33492
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
33460
|
-
console.log(
|
|
33493
|
+
console.log(chalk227.gray(`Capturing window for process "${processName}" ...`));
|
|
33461
33494
|
try {
|
|
33462
33495
|
runPowerShellScript(processName, outputPath);
|
|
33463
|
-
console.log(
|
|
33496
|
+
console.log(chalk227.green(`Screenshot saved: ${outputPath}`));
|
|
33464
33497
|
} catch (error) {
|
|
33465
33498
|
const msg = error instanceof Error ? error.message : String(error);
|
|
33466
|
-
console.error(
|
|
33499
|
+
console.error(chalk227.red(`Failed to capture screenshot: ${msg}`));
|
|
33467
33500
|
process.exit(1);
|
|
33468
33501
|
}
|
|
33469
33502
|
}
|
|
@@ -33519,11 +33552,11 @@ function applyLine(result, pending, line) {
|
|
|
33519
33552
|
}
|
|
33520
33553
|
|
|
33521
33554
|
// src/commands/sessions/daemon/readDaemonPidFile.ts
|
|
33522
|
-
import { readFileSync as
|
|
33555
|
+
import { readFileSync as readFileSync61 } from "fs";
|
|
33523
33556
|
function readDaemonPidFile() {
|
|
33524
33557
|
try {
|
|
33525
33558
|
const pid = Number.parseInt(
|
|
33526
|
-
|
|
33559
|
+
readFileSync61(daemonPaths.pid, "utf8").trim(),
|
|
33527
33560
|
10
|
|
33528
33561
|
);
|
|
33529
33562
|
return Number.isInteger(pid) ? pid : void 0;
|
|
@@ -33780,12 +33813,12 @@ function toSessionRunInfo({
|
|
|
33780
33813
|
}
|
|
33781
33814
|
|
|
33782
33815
|
// src/commands/sessions/daemon/worktree/joinRefusal.ts
|
|
33783
|
-
import { existsSync as
|
|
33816
|
+
import { existsSync as existsSync83 } from "fs";
|
|
33784
33817
|
function joinRefusal(session) {
|
|
33785
33818
|
if (session.commandType === "run") return "a server run has no agent stream";
|
|
33786
33819
|
if (session.closing === true) return "the session is closing";
|
|
33787
33820
|
if (!session.cwd) return "the session has no working directory";
|
|
33788
|
-
if (!
|
|
33821
|
+
if (!existsSync83(session.cwd))
|
|
33789
33822
|
return "the session's workspace no longer exists";
|
|
33790
33823
|
return void 0;
|
|
33791
33824
|
}
|
|
@@ -33949,26 +33982,26 @@ function sessionBase(id, status3) {
|
|
|
33949
33982
|
}
|
|
33950
33983
|
|
|
33951
33984
|
// src/commands/sessions/daemon/spawnPty.ts
|
|
33952
|
-
import { existsSync as
|
|
33985
|
+
import { existsSync as existsSync85 } from "fs";
|
|
33953
33986
|
import * as pty from "node-pty";
|
|
33954
33987
|
|
|
33955
33988
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
33956
|
-
import { chmodSync, existsSync as
|
|
33989
|
+
import { chmodSync, existsSync as existsSync84, statSync as statSync13 } from "fs";
|
|
33957
33990
|
import { createRequire as createRequire3 } from "module";
|
|
33958
|
-
import
|
|
33991
|
+
import path85 from "path";
|
|
33959
33992
|
var require4 = createRequire3(import.meta.url);
|
|
33960
33993
|
var ensured = false;
|
|
33961
33994
|
function ensureSpawnHelperExecutable() {
|
|
33962
33995
|
if (ensured || process.platform !== "darwin") return;
|
|
33963
33996
|
ensured = true;
|
|
33964
|
-
const ptyRoot =
|
|
33965
|
-
const helper =
|
|
33997
|
+
const ptyRoot = path85.join(path85.dirname(require4.resolve("node-pty")), "..");
|
|
33998
|
+
const helper = path85.join(
|
|
33966
33999
|
ptyRoot,
|
|
33967
34000
|
"prebuilds",
|
|
33968
34001
|
`${process.platform}-${process.arch}`,
|
|
33969
34002
|
"spawn-helper"
|
|
33970
34003
|
);
|
|
33971
|
-
if (!
|
|
34004
|
+
if (!existsSync84(helper)) return;
|
|
33972
34005
|
const mode = statSync13(helper).mode;
|
|
33973
34006
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
33974
34007
|
}
|
|
@@ -34004,7 +34037,7 @@ function spawnPty(args, cwd, sessionId, extraEnv) {
|
|
|
34004
34037
|
});
|
|
34005
34038
|
}
|
|
34006
34039
|
function refuseMissingCwd(cwd, sessionId) {
|
|
34007
|
-
if (!cwd ||
|
|
34040
|
+
if (!cwd || existsSync85(cwd)) return;
|
|
34008
34041
|
daemonLog(
|
|
34009
34042
|
`${sessionId ? `session ${sessionId}` : "pty"} not spawned: working directory ${cwd} no longer exists`
|
|
34010
34043
|
);
|
|
@@ -34083,12 +34116,12 @@ function serverRunMeta(runName, cwd) {
|
|
|
34083
34116
|
|
|
34084
34117
|
// src/commands/sessions/daemon/readDesignSystemPrompt.ts
|
|
34085
34118
|
import * as fs49 from "fs";
|
|
34086
|
-
import * as
|
|
34119
|
+
import * as path86 from "path";
|
|
34087
34120
|
import { fileURLToPath as fileURLToPath10 } from "url";
|
|
34088
34121
|
var __filename5 = fileURLToPath10(import.meta.url);
|
|
34089
|
-
var __dirname7 =
|
|
34122
|
+
var __dirname7 = path86.dirname(__filename5);
|
|
34090
34123
|
function readDesignSystemPrompt() {
|
|
34091
|
-
const promptPath =
|
|
34124
|
+
const promptPath = path86.join(
|
|
34092
34125
|
__dirname7,
|
|
34093
34126
|
"..",
|
|
34094
34127
|
"claude",
|
|
@@ -34186,11 +34219,11 @@ function setStatus2(session, newStatus) {
|
|
|
34186
34219
|
}
|
|
34187
34220
|
|
|
34188
34221
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
34189
|
-
import { existsSync as
|
|
34222
|
+
import { existsSync as existsSync87 } from "fs";
|
|
34190
34223
|
import { basename as basename22 } from "path";
|
|
34191
34224
|
|
|
34192
34225
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
34193
|
-
import { existsSync as
|
|
34226
|
+
import { existsSync as existsSync86 } from "fs";
|
|
34194
34227
|
import { join as join98 } from "path";
|
|
34195
34228
|
|
|
34196
34229
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
@@ -34260,7 +34293,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
34260
34293
|
);
|
|
34261
34294
|
}
|
|
34262
34295
|
function strandedReason(worktreePath, cause) {
|
|
34263
|
-
if (!
|
|
34296
|
+
if (!existsSync86(join98(worktreePath, ".git")))
|
|
34264
34297
|
return "its .git link is already gone";
|
|
34265
34298
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
34266
34299
|
return "git no longer recognises it as a working tree";
|
|
@@ -34312,7 +34345,7 @@ function reason3(error) {
|
|
|
34312
34345
|
|
|
34313
34346
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
34314
34347
|
async function reapWorktree(worktreePath, force = false) {
|
|
34315
|
-
if (!
|
|
34348
|
+
if (!existsSync87(worktreePath)) {
|
|
34316
34349
|
forgetWorktree(worktreePath);
|
|
34317
34350
|
daemonLog(
|
|
34318
34351
|
`worktree ${worktreePath} already gone; its record was forgotten`
|
|
@@ -34337,7 +34370,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
34337
34370
|
}
|
|
34338
34371
|
function owningClone(worktreePath) {
|
|
34339
34372
|
const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
|
|
34340
|
-
if (recorded &&
|
|
34373
|
+
if (recorded && existsSync87(recorded)) return recorded;
|
|
34341
34374
|
const detected = mainWorktree(worktreePath);
|
|
34342
34375
|
if (detected) return detected;
|
|
34343
34376
|
daemonLog(
|
|
@@ -34468,12 +34501,12 @@ function closeGateApplies(sessions, session) {
|
|
|
34468
34501
|
}
|
|
34469
34502
|
|
|
34470
34503
|
// src/commands/sessions/daemon/worktree/watchGitState.ts
|
|
34471
|
-
import { existsSync as
|
|
34504
|
+
import { existsSync as existsSync88, watch } from "fs";
|
|
34472
34505
|
var DEBOUNCE_MS = 500;
|
|
34473
34506
|
var POLL_MS = 3e4;
|
|
34474
34507
|
function watchGitState(cwd, onChange) {
|
|
34475
34508
|
const common = gitCommonDir(cwd);
|
|
34476
|
-
if (!common || !
|
|
34509
|
+
if (!common || !existsSync88(common)) return void 0;
|
|
34477
34510
|
const watchers = [
|
|
34478
34511
|
watchGitDir(common, onChange),
|
|
34479
34512
|
pollGitState(cwd, onChange)
|
|
@@ -34950,10 +34983,10 @@ function emitSessionOutput(session, clients, data) {
|
|
|
34950
34983
|
}
|
|
34951
34984
|
|
|
34952
34985
|
// src/commands/sessions/daemon/exitReason.ts
|
|
34953
|
-
import { existsSync as
|
|
34986
|
+
import { existsSync as existsSync89 } from "fs";
|
|
34954
34987
|
import { resolve as resolve22 } from "path";
|
|
34955
34988
|
function exitDetail(session) {
|
|
34956
|
-
if (session.cwd && !
|
|
34989
|
+
if (session.cwd && !existsSync89(session.cwd))
|
|
34957
34990
|
return `working directory ${session.cwd} no longer exists`;
|
|
34958
34991
|
return missingRunConfigCwd(session);
|
|
34959
34992
|
}
|
|
@@ -34967,7 +35000,7 @@ function missingRunConfigCwd(session) {
|
|
|
34967
35000
|
const config = resolveRunConfig(session.runName, dir);
|
|
34968
35001
|
if (!config?.cwd) return void 0;
|
|
34969
35002
|
const configured = resolve22(runConfigBaseDirFrom(dir), config.cwd);
|
|
34970
|
-
if (
|
|
35003
|
+
if (existsSync89(configured)) return void 0;
|
|
34971
35004
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
34972
35005
|
}
|
|
34973
35006
|
|
|
@@ -35008,7 +35041,7 @@ function handleFailedResume(session, exitCode, onStatusChange) {
|
|
|
35008
35041
|
}
|
|
35009
35042
|
|
|
35010
35043
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
35011
|
-
import { existsSync as
|
|
35044
|
+
import { existsSync as existsSync90, mkdirSync as mkdirSync33, watch as watch2 } from "fs";
|
|
35012
35045
|
import { dirname as dirname39 } from "path";
|
|
35013
35046
|
|
|
35014
35047
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
@@ -35070,8 +35103,8 @@ async function seedRunningMsFromUsage(session, notify2) {
|
|
|
35070
35103
|
var DEBOUNCE_MS2 = 50;
|
|
35071
35104
|
function watchActivity(session, notify2, onClaudeSessionId) {
|
|
35072
35105
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
35073
|
-
const
|
|
35074
|
-
const dir = dirname39(
|
|
35106
|
+
const path90 = activityPath(session.id);
|
|
35107
|
+
const dir = dirname39(path90);
|
|
35075
35108
|
try {
|
|
35076
35109
|
mkdirSync33(dir, { recursive: true });
|
|
35077
35110
|
} catch {
|
|
@@ -35081,7 +35114,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
35081
35114
|
let timer = null;
|
|
35082
35115
|
const read3 = () => {
|
|
35083
35116
|
timer = null;
|
|
35084
|
-
const activity2 = readActivity(
|
|
35117
|
+
const activity2 = readActivity(path90);
|
|
35085
35118
|
if (!activity2) return;
|
|
35086
35119
|
applyActivityToSession(session, activity2);
|
|
35087
35120
|
if (activity2.claudeSessionId) onClaudeSessionId?.(session);
|
|
@@ -35090,11 +35123,11 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
35090
35123
|
notify2();
|
|
35091
35124
|
};
|
|
35092
35125
|
session.activityWatcher = watch2(dir, (_event, filename) => {
|
|
35093
|
-
if (filename && !
|
|
35126
|
+
if (filename && !path90.endsWith(filename)) return;
|
|
35094
35127
|
if (timer) clearTimeout(timer);
|
|
35095
35128
|
timer = setTimeout(read3, DEBOUNCE_MS2);
|
|
35096
35129
|
});
|
|
35097
|
-
if (
|
|
35130
|
+
if (existsSync90(path90)) read3();
|
|
35098
35131
|
}
|
|
35099
35132
|
function refreshActivity(session) {
|
|
35100
35133
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -35237,12 +35270,12 @@ import { watch as watch3 } from "fs";
|
|
|
35237
35270
|
|
|
35238
35271
|
// src/commands/sessions/shared/findTranscriptPathSync.ts
|
|
35239
35272
|
import * as fs51 from "fs";
|
|
35240
|
-
import * as
|
|
35273
|
+
import * as path87 from "path";
|
|
35241
35274
|
function projectDirForCwd(cwd) {
|
|
35242
|
-
return
|
|
35275
|
+
return path87.join(claudeProjectsRoot(), projectSlug(cwd));
|
|
35243
35276
|
}
|
|
35244
35277
|
function transcriptPathFor(cwd, claudeSessionId) {
|
|
35245
|
-
return
|
|
35278
|
+
return path87.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
|
|
35246
35279
|
}
|
|
35247
35280
|
function findTranscriptPathSync(cwd, claudeSessionId) {
|
|
35248
35281
|
const direct = transcriptPathFor(cwd, claudeSessionId);
|
|
@@ -35256,8 +35289,8 @@ function findTranscriptPathSync(cwd, claudeSessionId) {
|
|
|
35256
35289
|
}
|
|
35257
35290
|
for (const file of files) {
|
|
35258
35291
|
if (!file.endsWith(".jsonl")) continue;
|
|
35259
|
-
if (headContainsSessionId(
|
|
35260
|
-
return
|
|
35292
|
+
if (headContainsSessionId(path87.join(dir, file), claudeSessionId))
|
|
35293
|
+
return path87.join(dir, file);
|
|
35261
35294
|
}
|
|
35262
35295
|
return null;
|
|
35263
35296
|
}
|
|
@@ -36431,9 +36464,9 @@ function tempRoots() {
|
|
|
36431
36464
|
}
|
|
36432
36465
|
return [...roots];
|
|
36433
36466
|
}
|
|
36434
|
-
function underTempRoot(
|
|
36467
|
+
function underTempRoot(path90) {
|
|
36435
36468
|
return tempRoots().some(
|
|
36436
|
-
(root) =>
|
|
36469
|
+
(root) => path90.startsWith(root.endsWith(sep2) ? root : root + sep2)
|
|
36437
36470
|
);
|
|
36438
36471
|
}
|
|
36439
36472
|
|
|
@@ -36745,7 +36778,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
36745
36778
|
}
|
|
36746
36779
|
|
|
36747
36780
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
36748
|
-
import { existsSync as
|
|
36781
|
+
import { existsSync as existsSync93 } from "fs";
|
|
36749
36782
|
import { basename as basename24 } from "path";
|
|
36750
36783
|
|
|
36751
36784
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
@@ -36800,18 +36833,18 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
36800
36833
|
}
|
|
36801
36834
|
|
|
36802
36835
|
// src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
|
|
36803
|
-
import { existsSync as
|
|
36836
|
+
import { existsSync as existsSync92 } from "fs";
|
|
36804
36837
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
36805
|
-
if (!
|
|
36806
|
-
for (const { path:
|
|
36838
|
+
if (!existsSync92(clone)) {
|
|
36839
|
+
for (const { path: path90 } of paths) forgetWorktree(path90);
|
|
36807
36840
|
daemonLog(
|
|
36808
36841
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
36809
36842
|
);
|
|
36810
36843
|
return;
|
|
36811
36844
|
}
|
|
36812
36845
|
await pruneBookkeeping2(clone);
|
|
36813
|
-
for (const { path:
|
|
36814
|
-
if (await reclaimBranch(clone, branch2)) forgetWorktree(
|
|
36846
|
+
for (const { path: path90, branch: branch2 } of paths)
|
|
36847
|
+
if (await reclaimBranch(clone, branch2)) forgetWorktree(path90);
|
|
36815
36848
|
}
|
|
36816
36849
|
async function pruneBookkeeping2(clone) {
|
|
36817
36850
|
try {
|
|
@@ -36838,37 +36871,37 @@ async function reclaimBranch(clone, branch2) {
|
|
|
36838
36871
|
}
|
|
36839
36872
|
|
|
36840
36873
|
// src/commands/sessions/daemon/worktree/logVanishedTree.ts
|
|
36841
|
-
function logVanishedTree(sessions,
|
|
36874
|
+
function logVanishedTree(sessions, path90) {
|
|
36842
36875
|
const claimants = [...sessions.values()].filter(
|
|
36843
|
-
(s) => s.cwd ===
|
|
36876
|
+
(s) => s.cwd === path90 || s.worktree?.path === path90
|
|
36844
36877
|
);
|
|
36845
36878
|
if (claimants.length === 0) {
|
|
36846
|
-
daemonLog(`worktree ${
|
|
36879
|
+
daemonLog(`worktree ${path90} gone from disk and unclaimed; reclaiming it`);
|
|
36847
36880
|
return;
|
|
36848
36881
|
}
|
|
36849
36882
|
for (const s of claimants)
|
|
36850
36883
|
daemonLog(
|
|
36851
|
-
`session ${s.id} ("${s.name}") claims worktree ${
|
|
36884
|
+
`session ${s.id} ("${s.name}") claims worktree ${path90}, which is gone from disk; reclaiming it`
|
|
36852
36885
|
);
|
|
36853
36886
|
}
|
|
36854
36887
|
|
|
36855
36888
|
// src/commands/sessions/daemon/worktree/describeHeldWork.ts
|
|
36856
36889
|
var MAX_ITEMS = 20;
|
|
36857
|
-
async function describeHeldWork(
|
|
36858
|
-
if (reason4.startsWith("uncommitted")) return await changedFiles(
|
|
36859
|
-
if (reason4.startsWith("unpushed")) return await unpushedCommits(
|
|
36890
|
+
async function describeHeldWork(path90, reason4) {
|
|
36891
|
+
if (reason4.startsWith("uncommitted")) return await changedFiles(path90);
|
|
36892
|
+
if (reason4.startsWith("unpushed")) return await unpushedCommits(path90, reason4);
|
|
36860
36893
|
return { summary: reason4, items: [] };
|
|
36861
36894
|
}
|
|
36862
|
-
async function changedFiles(
|
|
36863
|
-
const status3 = await gitResult(
|
|
36895
|
+
async function changedFiles(path90) {
|
|
36896
|
+
const status3 = await gitResult(path90, ["status", "--porcelain"]);
|
|
36864
36897
|
const lines2 = status3.ok ? nonEmptyLines(status3.out) : [];
|
|
36865
36898
|
return {
|
|
36866
36899
|
summary: `${lines2.length} uncommitted ${lines2.length === 1 ? "file" : "files"}`,
|
|
36867
36900
|
items: capped(lines2)
|
|
36868
36901
|
};
|
|
36869
36902
|
}
|
|
36870
|
-
async function unpushedCommits(
|
|
36871
|
-
const log2 = await gitResult(
|
|
36903
|
+
async function unpushedCommits(path90, reason4) {
|
|
36904
|
+
const log2 = await gitResult(path90, ["log", "--oneline", "@{upstream}..HEAD"]);
|
|
36872
36905
|
if (!log2.ok) return { summary: reason4, items: [] };
|
|
36873
36906
|
const lines2 = nonEmptyLines(log2.out);
|
|
36874
36907
|
return {
|
|
@@ -36960,24 +36993,24 @@ function reconcileWorktreesOnRestore(sessions, spawnWith, notify2) {
|
|
|
36960
36993
|
async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
36961
36994
|
const accounted = accountedTrees(sessions);
|
|
36962
36995
|
const vanished = /* @__PURE__ */ new Map();
|
|
36963
|
-
for (const { path:
|
|
36964
|
-
if (underTempRoot(
|
|
36965
|
-
forgetWorktree(
|
|
36996
|
+
for (const { path: path90, clone } of readWorktreeRegistry()) {
|
|
36997
|
+
if (underTempRoot(path90)) {
|
|
36998
|
+
forgetWorktree(path90);
|
|
36966
36999
|
daemonLog(
|
|
36967
|
-
`worktree ${
|
|
37000
|
+
`worktree ${path90} lies outside any project root; pruned from the registry rather than recovered`
|
|
36968
37001
|
);
|
|
36969
37002
|
continue;
|
|
36970
37003
|
}
|
|
36971
|
-
if (!
|
|
36972
|
-
logVanishedTree(sessions,
|
|
37004
|
+
if (!existsSync93(path90)) {
|
|
37005
|
+
logVanishedTree(sessions, path90);
|
|
36973
37006
|
vanished.set(clone, [
|
|
36974
37007
|
...vanished.get(clone) ?? [],
|
|
36975
|
-
{ path:
|
|
37008
|
+
{ path: path90, branch: basename24(path90) }
|
|
36976
37009
|
]);
|
|
36977
37010
|
continue;
|
|
36978
37011
|
}
|
|
36979
|
-
if (accounted.has(
|
|
36980
|
-
await recoverOrphan(sessions, spawnWith, { path:
|
|
37012
|
+
if (accounted.has(path90)) continue;
|
|
37013
|
+
await recoverOrphan(sessions, spawnWith, { path: path90, clone }, notify2);
|
|
36981
37014
|
}
|
|
36982
37015
|
for (const [clone, paths] of vanished)
|
|
36983
37016
|
await reclaimVanishedWorktrees(clone, paths);
|
|
@@ -37585,14 +37618,14 @@ async function defaultConnect() {
|
|
|
37585
37618
|
}
|
|
37586
37619
|
|
|
37587
37620
|
// src/commands/sessions/daemon/hasPersistedWindowsSessions.ts
|
|
37588
|
-
import { existsSync as
|
|
37621
|
+
import { existsSync as existsSync94, readFileSync as readFileSync63 } from "fs";
|
|
37589
37622
|
import { posix as posix3 } from "path";
|
|
37590
37623
|
function hasPersistedWindowsSessions() {
|
|
37591
37624
|
const sessionsFile = windowsSessionsFileFromWsl();
|
|
37592
37625
|
if (!sessionsFile) return false;
|
|
37593
37626
|
try {
|
|
37594
|
-
if (!
|
|
37595
|
-
const data = JSON.parse(
|
|
37627
|
+
if (!existsSync94(sessionsFile)) return false;
|
|
37628
|
+
const data = JSON.parse(readFileSync63(sessionsFile, "utf8"));
|
|
37596
37629
|
return Array.isArray(data) && data.length > 0;
|
|
37597
37630
|
} catch (error) {
|
|
37598
37631
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
@@ -38326,7 +38359,7 @@ function setAutoAdvance(sessions, id, enabled) {
|
|
|
38326
38359
|
}
|
|
38327
38360
|
|
|
38328
38361
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
38329
|
-
import { existsSync as
|
|
38362
|
+
import { existsSync as existsSync97 } from "fs";
|
|
38330
38363
|
|
|
38331
38364
|
// src/commands/sessions/daemon/resumeSession.ts
|
|
38332
38365
|
function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
@@ -38357,10 +38390,10 @@ function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
|
38357
38390
|
}
|
|
38358
38391
|
|
|
38359
38392
|
// src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
|
|
38360
|
-
import { existsSync as
|
|
38393
|
+
import { existsSync as existsSync96 } from "fs";
|
|
38361
38394
|
|
|
38362
38395
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
38363
|
-
import { copyFileSync as copyFileSync7, existsSync as
|
|
38396
|
+
import { copyFileSync as copyFileSync7, existsSync as existsSync95, mkdirSync as mkdirSync35 } from "fs";
|
|
38364
38397
|
import { join as join100 } from "path";
|
|
38365
38398
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
38366
38399
|
const dir = projectDirForCwd(toCwd);
|
|
@@ -38371,7 +38404,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
38371
38404
|
return;
|
|
38372
38405
|
}
|
|
38373
38406
|
const dest = join100(dir, `${claudeSessionId}.jsonl`);
|
|
38374
|
-
if (
|
|
38407
|
+
if (existsSync95(dest)) {
|
|
38375
38408
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
38376
38409
|
return;
|
|
38377
38410
|
}
|
|
@@ -38422,7 +38455,7 @@ function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name, harness
|
|
|
38422
38455
|
}
|
|
38423
38456
|
function cloneForReapedTree(missingCwd) {
|
|
38424
38457
|
const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
|
|
38425
|
-
if (!clone || !
|
|
38458
|
+
if (!clone || !existsSync96(clone))
|
|
38426
38459
|
throw new Error(
|
|
38427
38460
|
`working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
|
|
38428
38461
|
);
|
|
@@ -38431,7 +38464,7 @@ function cloneForReapedTree(missingCwd) {
|
|
|
38431
38464
|
|
|
38432
38465
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
38433
38466
|
function resumeInTree(ctx, sessionId, cwd, name, harness) {
|
|
38434
|
-
if (!
|
|
38467
|
+
if (!existsSync97(cwd))
|
|
38435
38468
|
return resumeInReplacementTree(ctx, sessionId, cwd, name, harness);
|
|
38436
38469
|
const id = ctx.spawnWith(
|
|
38437
38470
|
(sid) => resumeSession(sid, sessionId, cwd, name, void 0, harness)
|
|
@@ -38698,12 +38731,12 @@ function handleSetStatus(client, m, d) {
|
|
|
38698
38731
|
import * as fs54 from "fs";
|
|
38699
38732
|
|
|
38700
38733
|
// src/commands/sessions/shared/codex/findCodexRolloutPath.ts
|
|
38701
|
-
import * as
|
|
38734
|
+
import * as path88 from "path";
|
|
38702
38735
|
async function findCodexRolloutPath(sessionId) {
|
|
38703
38736
|
if (!sessionId) return null;
|
|
38704
38737
|
const paths = await discoverCodexRolloutPaths();
|
|
38705
38738
|
const suffix = `-${sessionId}.jsonl`;
|
|
38706
|
-
return paths.find((file) =>
|
|
38739
|
+
return paths.find((file) => path88.basename(file).endsWith(suffix)) ?? null;
|
|
38707
38740
|
}
|
|
38708
38741
|
|
|
38709
38742
|
// src/commands/sessions/shared/codex/codexToolTarget.ts
|
|
@@ -39008,10 +39041,10 @@ function handleConnection(socket, manager) {
|
|
|
39008
39041
|
}
|
|
39009
39042
|
|
|
39010
39043
|
// src/commands/sessions/daemon/onListening.ts
|
|
39011
|
-
import { unlinkSync as unlinkSync23, writeFileSync as
|
|
39044
|
+
import { unlinkSync as unlinkSync23, writeFileSync as writeFileSync50 } from "fs";
|
|
39012
39045
|
|
|
39013
39046
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
39014
|
-
import { readFileSync as
|
|
39047
|
+
import { readFileSync as readFileSync64 } from "fs";
|
|
39015
39048
|
var WATCHDOG_INTERVAL_MS = 5e3;
|
|
39016
39049
|
function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
39017
39050
|
const timer = setInterval(() => {
|
|
@@ -39022,7 +39055,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
|
39022
39055
|
}
|
|
39023
39056
|
function ownsPidFile() {
|
|
39024
39057
|
try {
|
|
39025
|
-
return
|
|
39058
|
+
return readFileSync64(daemonPaths.pid, "utf8").trim() === String(process.pid);
|
|
39026
39059
|
} catch {
|
|
39027
39060
|
return false;
|
|
39028
39061
|
}
|
|
@@ -39030,7 +39063,7 @@ function ownsPidFile() {
|
|
|
39030
39063
|
|
|
39031
39064
|
// src/commands/sessions/daemon/onListening.ts
|
|
39032
39065
|
function onListening(manager, checkAutoExit) {
|
|
39033
|
-
|
|
39066
|
+
writeFileSync50(daemonPaths.pid, String(process.pid));
|
|
39034
39067
|
startPidFileWatchdog(() => {
|
|
39035
39068
|
daemonLog("lost daemon.pid ownership; shutting down sessions and exiting");
|
|
39036
39069
|
void manager.flushActiveMs().finally(() => {
|
|
@@ -39272,7 +39305,7 @@ function registerSetStatusCommand(cmd) {
|
|
|
39272
39305
|
|
|
39273
39306
|
// src/commands/sessions/summarise/index.ts
|
|
39274
39307
|
import * as fs56 from "fs";
|
|
39275
|
-
import
|
|
39308
|
+
import chalk228 from "chalk";
|
|
39276
39309
|
|
|
39277
39310
|
// src/commands/sessions/summarise/shared.ts
|
|
39278
39311
|
import * as fs55 from "fs";
|
|
@@ -39331,22 +39364,22 @@ ${firstMessage}`);
|
|
|
39331
39364
|
async function summarise2(options2) {
|
|
39332
39365
|
const files = await discoverSessionFiles();
|
|
39333
39366
|
if (files.length === 0) {
|
|
39334
|
-
console.log(
|
|
39367
|
+
console.log(chalk228.yellow("No sessions found."));
|
|
39335
39368
|
return;
|
|
39336
39369
|
}
|
|
39337
39370
|
const toProcess = selectCandidates(files, options2);
|
|
39338
39371
|
if (toProcess.length === 0) {
|
|
39339
|
-
console.log(
|
|
39372
|
+
console.log(chalk228.green("All sessions already summarised."));
|
|
39340
39373
|
return;
|
|
39341
39374
|
}
|
|
39342
39375
|
console.log(
|
|
39343
|
-
|
|
39376
|
+
chalk228.cyan(
|
|
39344
39377
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
39345
39378
|
)
|
|
39346
39379
|
);
|
|
39347
39380
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
39348
39381
|
console.log(
|
|
39349
|
-
|
|
39382
|
+
chalk228.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk228.yellow(`, ${failed2} skipped`) : "")
|
|
39350
39383
|
);
|
|
39351
39384
|
}
|
|
39352
39385
|
function selectCandidates(files, options2) {
|
|
@@ -39366,16 +39399,16 @@ function processSessions(files) {
|
|
|
39366
39399
|
let failed2 = 0;
|
|
39367
39400
|
for (let i = 0; i < files.length; i++) {
|
|
39368
39401
|
const file = files[i];
|
|
39369
|
-
process.stdout.write(
|
|
39402
|
+
process.stdout.write(chalk228.dim(` [${i + 1}/${files.length}] `));
|
|
39370
39403
|
const summary = summariseSession(file);
|
|
39371
39404
|
if (summary) {
|
|
39372
39405
|
writeSummary(file, summary);
|
|
39373
39406
|
succeeded++;
|
|
39374
|
-
process.stdout.write(`${
|
|
39407
|
+
process.stdout.write(`${chalk228.green("\u2713")} ${summary}
|
|
39375
39408
|
`);
|
|
39376
39409
|
} else {
|
|
39377
39410
|
failed2++;
|
|
39378
|
-
process.stdout.write(` ${
|
|
39411
|
+
process.stdout.write(` ${chalk228.yellow("skip")}
|
|
39379
39412
|
`);
|
|
39380
39413
|
}
|
|
39381
39414
|
}
|
|
@@ -39396,7 +39429,7 @@ function registerSessions(program2) {
|
|
|
39396
39429
|
}
|
|
39397
39430
|
|
|
39398
39431
|
// src/commands/statusLine.ts
|
|
39399
|
-
import
|
|
39432
|
+
import chalk230 from "chalk";
|
|
39400
39433
|
|
|
39401
39434
|
// src/shared/contextLevel.ts
|
|
39402
39435
|
function contextLevel(pct) {
|
|
@@ -39406,7 +39439,7 @@ function contextLevel(pct) {
|
|
|
39406
39439
|
}
|
|
39407
39440
|
|
|
39408
39441
|
// src/commands/buildLimitsSegment.ts
|
|
39409
|
-
import
|
|
39442
|
+
import chalk229 from "chalk";
|
|
39410
39443
|
|
|
39411
39444
|
// src/shared/rateLimitLevel.ts
|
|
39412
39445
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -39444,9 +39477,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
39444
39477
|
|
|
39445
39478
|
// src/commands/buildLimitsSegment.ts
|
|
39446
39479
|
var LEVEL_COLOR = {
|
|
39447
|
-
ok:
|
|
39448
|
-
warn:
|
|
39449
|
-
over:
|
|
39480
|
+
ok: chalk229.green,
|
|
39481
|
+
warn: chalk229.yellow,
|
|
39482
|
+
over: chalk229.red
|
|
39450
39483
|
};
|
|
39451
39484
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
39452
39485
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -39477,7 +39510,7 @@ function buildLimitsSegment(rateLimits) {
|
|
|
39477
39510
|
}
|
|
39478
39511
|
|
|
39479
39512
|
// src/commands/readGitBranch.ts
|
|
39480
|
-
import { readFileSync as
|
|
39513
|
+
import { readFileSync as readFileSync66, statSync as statSync16 } from "fs";
|
|
39481
39514
|
import { isAbsolute as isAbsolute5, join as join101, resolve as resolve23 } from "path";
|
|
39482
39515
|
function resolveGitDir(cwd) {
|
|
39483
39516
|
const dotGit = join101(cwd, ".git");
|
|
@@ -39492,7 +39525,7 @@ function resolveGitDir(cwd) {
|
|
|
39492
39525
|
}
|
|
39493
39526
|
let contents;
|
|
39494
39527
|
try {
|
|
39495
|
-
contents =
|
|
39528
|
+
contents = readFileSync66(dotGit, "utf8");
|
|
39496
39529
|
} catch {
|
|
39497
39530
|
return null;
|
|
39498
39531
|
}
|
|
@@ -39510,7 +39543,7 @@ function readGitBranch(cwd) {
|
|
|
39510
39543
|
}
|
|
39511
39544
|
let head;
|
|
39512
39545
|
try {
|
|
39513
|
-
head =
|
|
39546
|
+
head = readFileSync66(join101(gitDir, "HEAD"), "utf8");
|
|
39514
39547
|
} catch {
|
|
39515
39548
|
return null;
|
|
39516
39549
|
}
|
|
@@ -39542,7 +39575,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
39542
39575
|
}
|
|
39543
39576
|
|
|
39544
39577
|
// src/commands/statusLine.ts
|
|
39545
|
-
|
|
39578
|
+
chalk230.level = 3;
|
|
39546
39579
|
function formatNumber(num) {
|
|
39547
39580
|
return num.toLocaleString("en-US");
|
|
39548
39581
|
}
|
|
@@ -39550,9 +39583,9 @@ function colorizePercent(pct) {
|
|
|
39550
39583
|
const label2 = `${Math.round(pct)}%`;
|
|
39551
39584
|
switch (contextLevel(pct)) {
|
|
39552
39585
|
case "red":
|
|
39553
|
-
return
|
|
39586
|
+
return chalk230.red(label2);
|
|
39554
39587
|
case "yellow":
|
|
39555
|
-
return
|
|
39588
|
+
return chalk230.yellow(label2);
|
|
39556
39589
|
default:
|
|
39557
39590
|
return label2;
|
|
39558
39591
|
}
|
|
@@ -39565,7 +39598,7 @@ async function statusLine() {
|
|
|
39565
39598
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
39566
39599
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
39567
39600
|
const branch2 = dir ? readGitBranch(toGitCwd(dir)) : null;
|
|
39568
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
39601
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk230.cyan(branch2)} | ` : "";
|
|
39569
39602
|
console.log(
|
|
39570
39603
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
39571
39604
|
);
|
|
@@ -39579,7 +39612,7 @@ async function statusLine() {
|
|
|
39579
39612
|
|
|
39580
39613
|
// src/commands/update.ts
|
|
39581
39614
|
import { execSync as execSync61 } from "child_process";
|
|
39582
|
-
import * as
|
|
39615
|
+
import * as path89 from "path";
|
|
39583
39616
|
|
|
39584
39617
|
// src/commands/restartDaemonAfterUpdate.ts
|
|
39585
39618
|
async function restartDaemonAfterUpdate() {
|
|
@@ -39598,12 +39631,12 @@ async function restartDaemonAfterUpdate() {
|
|
|
39598
39631
|
// src/commands/update.ts
|
|
39599
39632
|
function isGlobalNpmInstall(dir) {
|
|
39600
39633
|
try {
|
|
39601
|
-
const resolved =
|
|
39602
|
-
if (resolved.split(
|
|
39634
|
+
const resolved = path89.resolve(dir);
|
|
39635
|
+
if (resolved.split(path89.sep).includes("node_modules")) {
|
|
39603
39636
|
return true;
|
|
39604
39637
|
}
|
|
39605
39638
|
const globalPrefix = execSync61("npm prefix -g", { stdio: "pipe" }).toString().trim();
|
|
39606
|
-
return resolved.toLowerCase().startsWith(
|
|
39639
|
+
return resolved.toLowerCase().startsWith(path89.resolve(globalPrefix).toLowerCase());
|
|
39607
39640
|
} catch {
|
|
39608
39641
|
return false;
|
|
39609
39642
|
}
|
|
@@ -39635,10 +39668,10 @@ async function update2() {
|
|
|
39635
39668
|
}
|
|
39636
39669
|
|
|
39637
39670
|
// src/reportCliError.ts
|
|
39638
|
-
import
|
|
39671
|
+
import chalk231 from "chalk";
|
|
39639
39672
|
function reportCliError(error) {
|
|
39640
39673
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError) {
|
|
39641
|
-
console.error(
|
|
39674
|
+
console.error(chalk231.red(error.message));
|
|
39642
39675
|
} else {
|
|
39643
39676
|
console.error(error);
|
|
39644
39677
|
}
|