@staff0rd/assist 0.593.0 → 0.595.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 +5 -1
- package/allowed.cli-reads +1 -0
- package/dist/allowed.cli-reads +1 -0
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +621 -491
- 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.595.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(path83) {
|
|
191
|
+
return path83.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(path83) {
|
|
242
242
|
try {
|
|
243
|
-
return statSync(
|
|
243
|
+
return statSync(path83).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(path83) {
|
|
263
263
|
try {
|
|
264
|
-
const content = readFileSync(
|
|
264
|
+
const content = readFileSync(path83, "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(path83) {
|
|
278
|
+
if (!existsSync2(path83)) return {};
|
|
279
279
|
try {
|
|
280
|
-
const content = readFileSync2(
|
|
280
|
+
const content = readFileSync2(path83, "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 path83 = origin.slice("local:".length).replace(/\/+$/, "");
|
|
353
|
+
const segments = path83.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 path83 = line.split(" ")[1];
|
|
1789
|
+
if (path83) found.add(path83.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 path83 = kind === "branch" ? "tree" : "commit";
|
|
1900
|
+
return `https://github.com/${repo.org}/${repo.repo}/${path83}/${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, path83) {
|
|
4277
4277
|
const { inner, defaultValue, optional } = unwrapSchemaNode(node);
|
|
4278
4278
|
const secret = isSecretSchemaNode(node) || isSecretSchemaNode(inner);
|
|
4279
4279
|
const base = {
|
|
4280
|
-
path:
|
|
4280
|
+
path: path83,
|
|
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(path83) {
|
|
4300
4300
|
let text18 = "";
|
|
4301
|
-
for (const segment of
|
|
4301
|
+
for (const segment of path83) {
|
|
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, path83) {
|
|
4950
4950
|
let current = data;
|
|
4951
|
-
for (const segment of
|
|
4951
|
+
for (const segment of path83.split(".")) {
|
|
4952
4952
|
if (current === null || typeof current !== "object") return [];
|
|
4953
4953
|
current = current[segment];
|
|
4954
4954
|
}
|
|
@@ -4961,10 +4961,10 @@ function resolveStringsAtPath(data, path80) {
|
|
|
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 path83 of rule.paths) {
|
|
4965
|
+
for (const value of resolveStringsAtPath(data, path83)) {
|
|
4966
4966
|
if (minimatch2(value, rule.disallowed))
|
|
4967
|
-
violations.push({ file: rule.file, path:
|
|
4967
|
+
violations.push({ file: rule.file, path: path83, 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: path83, value } of violations) {
|
|
5007
|
+
console.log(` ${file} ${path83}: ${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((path83) => MIGRATION_FILE3.test(basename2(path83)));
|
|
5323
|
+
for (const path83 of paths) {
|
|
5324
5324
|
try {
|
|
5325
|
-
const content = execSync14(`git show "${ref}:${
|
|
5325
|
+
const content = execSync14(`git show "${ref}:${path83}"`, {
|
|
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(path83), 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 path83 = daemonPaths.hooksSettings;
|
|
6765
|
+
mkdirSync5(dirname13(path83), { recursive: true });
|
|
6766
|
+
writeFileSync15(path83, JSON.stringify(hooksSettings, null, 2));
|
|
6767
|
+
return path83;
|
|
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 path83 = join15(dir, ".assist", name);
|
|
7066
|
+
if (existsSync19(path83)) {
|
|
7067
|
+
renameSync(path83, `${path83}.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(path83) {
|
|
7548
|
+
const content = readFileSync15(path83, "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 path83 = getOwnerPath(itemId2);
|
|
8360
|
+
mkdirSync7(dirname15(path83), { recursive: true });
|
|
8361
|
+
writeFileSync17(path83, JSON.stringify({ sessionId }));
|
|
8362
8362
|
}
|
|
8363
8363
|
function readSignalOwner(itemId2) {
|
|
8364
|
-
const
|
|
8365
|
-
if (!existsSync23(
|
|
8364
|
+
const path83 = getOwnerPath(itemId2);
|
|
8365
|
+
if (!existsSync23(path83)) return void 0;
|
|
8366
8366
|
try {
|
|
8367
|
-
const parsed = JSON.parse(readFileSync16(
|
|
8367
|
+
const parsed = JSON.parse(readFileSync16(path83, "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 path83 = getOwnerPath(itemId2);
|
|
8375
8375
|
try {
|
|
8376
|
-
rmSync(
|
|
8376
|
+
rmSync(path83);
|
|
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 path83 = getSignalPath(target);
|
|
8414
|
+
if (!path83) return;
|
|
8415
8415
|
const signal = { event, sessionId: target, ...data };
|
|
8416
|
-
mkdirSync8(dirname16(
|
|
8417
|
-
writeFileSync18(
|
|
8416
|
+
mkdirSync8(dirname16(path83), { recursive: true });
|
|
8417
|
+
writeFileSync18(path83, JSON.stringify(signal));
|
|
8418
8418
|
}
|
|
8419
8419
|
|
|
8420
8420
|
// src/commands/backlog/readSignal.ts
|
|
8421
8421
|
function readSignal() {
|
|
8422
|
-
const
|
|
8423
|
-
if (!
|
|
8422
|
+
const path83 = getSignalPath();
|
|
8423
|
+
if (!path83 || !existsSync24(path83)) return void 0;
|
|
8424
8424
|
try {
|
|
8425
|
-
return JSON.parse(readFileSync17(
|
|
8425
|
+
return JSON.parse(readFileSync17(path83, "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 path83 = activityPath(sessionId);
|
|
8623
|
+
mkdirSync9(dirname17(path83), { recursive: true });
|
|
8624
|
+
writeFileSync19(path83, JSON.stringify({ ...activity2, startedAt: Date.now() }));
|
|
8625
8625
|
}
|
|
8626
|
-
function readActivity(
|
|
8626
|
+
function readActivity(path83) {
|
|
8627
8627
|
try {
|
|
8628
|
-
return JSON.parse(readFileSync18(
|
|
8628
|
+
return JSON.parse(readFileSync18(path83, "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 path83 = activityPath(sessionId);
|
|
8639
|
+
mkdirSync9(dirname17(path83), { recursive: true });
|
|
8640
|
+
writeFileSync19(path83, 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 path83 = getStorePath(filename);
|
|
10094
|
+
if (existsSync29(path83)) {
|
|
10095
10095
|
try {
|
|
10096
|
-
return JSON.parse(readFileSync19(
|
|
10096
|
+
return JSON.parse(readFileSync19(path83, "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(([path83, record]) => ({ path: path83, ...record }));
|
|
10116
10116
|
}
|
|
10117
|
-
function worktreeAttributionIncludingReaped(
|
|
10118
|
-
const record = loadJson(REGISTRY_FILE)[
|
|
10117
|
+
function worktreeAttributionIncludingReaped(path83) {
|
|
10118
|
+
const record = loadJson(REGISTRY_FILE)[path83];
|
|
10119
10119
|
return record ? { clone: record.clone, origin: record.origin } : void 0;
|
|
10120
10120
|
}
|
|
10121
|
-
function recordWorktree(
|
|
10121
|
+
function recordWorktree(path83, clone, origin) {
|
|
10122
10122
|
const data = loadJson(REGISTRY_FILE);
|
|
10123
|
-
data[
|
|
10123
|
+
data[path83] = { clone, origin };
|
|
10124
10124
|
saveJson(REGISTRY_FILE, data);
|
|
10125
10125
|
}
|
|
10126
|
-
function forgetWorktree(
|
|
10126
|
+
function forgetWorktree(path83) {
|
|
10127
10127
|
const data = loadJson(REGISTRY_FILE);
|
|
10128
|
-
const record = data[
|
|
10128
|
+
const record = data[path83];
|
|
10129
10129
|
if (!record || record.reaped) return;
|
|
10130
|
-
data[
|
|
10130
|
+
data[path83] = { ...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 path83 of resolved.paths) {
|
|
10882
|
+
if (!bases.has(path83)) bases.set(path83, 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 [path83, 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(path83);
|
|
10903
|
+
else groups.set(base, [path83]);
|
|
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((path83) => path83 && !bases.has(path83)).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, path83) {
|
|
10919
|
+
return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path83], {
|
|
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((path83) => untrackedFileDiff(cwd, path83))
|
|
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, path83) {
|
|
11026
11026
|
const root = repoRoot(cwd);
|
|
11027
|
-
const target = resolve10(root,
|
|
11027
|
+
const target = resolve10(root, path83);
|
|
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, path80) {
|
|
|
11034
11034
|
function getFileTarget(req, res) {
|
|
11035
11035
|
const cwd = getCwdParam(req, res);
|
|
11036
11036
|
if (!cwd) return null;
|
|
11037
|
-
const
|
|
11037
|
+
const path83 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
|
|
11038
11038
|
"path"
|
|
11039
11039
|
);
|
|
11040
|
-
if (!
|
|
11040
|
+
if (!path83) {
|
|
11041
11041
|
respondJson(res, 400, { error: "Missing path" });
|
|
11042
11042
|
return null;
|
|
11043
11043
|
}
|
|
11044
|
-
const target = resolveWithinCwd(cwd,
|
|
11044
|
+
const target = resolveWithinCwd(cwd, path83);
|
|
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(path83) {
|
|
11120
|
+
if (path83 === getGlobalConfigPath()) return "~/.assist.yml";
|
|
11121
|
+
if (path83.startsWith(WINDOWS_MOUNT_PREFIX))
|
|
11122
|
+
return `${path83} on the Windows host`;
|
|
11123
|
+
return path83;
|
|
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, path83, 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, [...path83, name], childNode(name), map)
|
|
11186
11186
|
])
|
|
11187
11187
|
);
|
|
11188
11188
|
}
|
|
11189
|
-
function mapItems(value,
|
|
11189
|
+
function mapItems(value, path83, 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, [...path83, index3], item, map));
|
|
11192
11192
|
}
|
|
11193
|
-
function walk(value,
|
|
11193
|
+
function walk(value, path83, 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, path83);
|
|
11196
11196
|
switch (node.kind) {
|
|
11197
11197
|
case "object":
|
|
11198
11198
|
case "unionOfObjects":
|
|
11199
11199
|
return mapChildren(
|
|
11200
11200
|
value,
|
|
11201
|
-
|
|
11201
|
+
path83,
|
|
11202
11202
|
(name) => configNodeField(node, name),
|
|
11203
11203
|
map
|
|
11204
11204
|
);
|
|
11205
11205
|
case "objectList":
|
|
11206
|
-
return mapItems(value,
|
|
11206
|
+
return mapItems(value, path83, node.item, map);
|
|
11207
11207
|
case "record":
|
|
11208
|
-
return mapChildren(value,
|
|
11208
|
+
return mapChildren(value, path83, () => 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, path83) {
|
|
11234
11234
|
let current = obj;
|
|
11235
|
-
for (const key of
|
|
11235
|
+
for (const key of path83.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, path83) {
|
|
11286
11286
|
let current = root;
|
|
11287
|
-
for (const segment of
|
|
11287
|
+
for (const segment of path83) {
|
|
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 path83 = [];
|
|
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
|
+
path83.push(segment);
|
|
11312
11312
|
at2 = close + 1;
|
|
11313
11313
|
continue;
|
|
11314
11314
|
}
|
|
11315
11315
|
if (text18[at2] === ".") {
|
|
11316
|
-
if (
|
|
11316
|
+
if (path83.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
|
+
path83.push(nameSegment(name));
|
|
11324
11324
|
}
|
|
11325
|
-
return
|
|
11325
|
+
return path83;
|
|
11326
11326
|
}
|
|
11327
11327
|
|
|
11328
11328
|
// src/commands/config/configEntryNode.ts
|
|
11329
11329
|
function configEntryNode(root, key) {
|
|
11330
|
-
const
|
|
11331
|
-
return
|
|
11330
|
+
const path83 = parseConfigPath(key);
|
|
11331
|
+
return path83 ? findConfigNode(root, path83) : 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((path83) => existsSync32(path83)).map((path83) => ({ path: path83, mtime: statSync4(path83).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 path83 = await resolveSynthesisPath(cwd);
|
|
11497
|
+
if (!path83) {
|
|
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(path83, "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 path83 = fields[fields.length - 1];
|
|
11585
|
+
if (path83) result[category].push(path83);
|
|
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(path83, query) {
|
|
11722
11722
|
const needle = query.trim().toLowerCase();
|
|
11723
11723
|
if (!needle) return 0;
|
|
11724
|
-
const basename26 =
|
|
11724
|
+
const basename26 = path83.slice(path83.lastIndexOf("/") + 1);
|
|
11725
11725
|
const inBasename = subsequenceScore(basename26, needle);
|
|
11726
11726
|
if (inBasename !== null) return BASENAME_WEIGHT + inBasename;
|
|
11727
|
-
return subsequenceScore(
|
|
11727
|
+
return subsequenceScore(path83, 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 path83 of paths) {
|
|
11734
|
+
const score = scoreFilePath(path83, query);
|
|
11735
|
+
if (score !== null) scored.push({ path: path83, 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);
|
|
@@ -12197,38 +12197,38 @@ async function restartWeb(req, res, deps2 = {}) {
|
|
|
12197
12197
|
import { relative as relative3 } from "path";
|
|
12198
12198
|
|
|
12199
12199
|
// src/commands/sessions/web/revertPathChanges.ts
|
|
12200
|
-
async function isTracked(cwd,
|
|
12200
|
+
async function isTracked(cwd, path83) {
|
|
12201
12201
|
try {
|
|
12202
|
-
await execGit(cwd, ["ls-files", "--error-unmatch", "--",
|
|
12202
|
+
await execGit(cwd, ["ls-files", "--error-unmatch", "--", path83]);
|
|
12203
12203
|
return true;
|
|
12204
12204
|
} catch {
|
|
12205
12205
|
return false;
|
|
12206
12206
|
}
|
|
12207
12207
|
}
|
|
12208
|
-
async function isInHead(cwd,
|
|
12209
|
-
const listing = await execGit(cwd, ["ls-tree", "HEAD", "--",
|
|
12208
|
+
async function isInHead(cwd, path83) {
|
|
12209
|
+
const listing = await execGit(cwd, ["ls-tree", "HEAD", "--", path83]);
|
|
12210
12210
|
return listing.trim().length > 0;
|
|
12211
12211
|
}
|
|
12212
|
-
async function revertPathChanges(cwd,
|
|
12213
|
-
if (!await isTracked(cwd,
|
|
12214
|
-
await execGit(cwd, ["clean", "-f", "--",
|
|
12212
|
+
async function revertPathChanges(cwd, path83) {
|
|
12213
|
+
if (!await isTracked(cwd, path83)) {
|
|
12214
|
+
await execGit(cwd, ["clean", "-f", "--", path83]);
|
|
12215
12215
|
return;
|
|
12216
12216
|
}
|
|
12217
|
-
if (await isInHead(cwd,
|
|
12218
|
-
await execGit(cwd, ["checkout", "HEAD", "--",
|
|
12217
|
+
if (await isInHead(cwd, path83)) {
|
|
12218
|
+
await execGit(cwd, ["checkout", "HEAD", "--", path83]);
|
|
12219
12219
|
return;
|
|
12220
12220
|
}
|
|
12221
|
-
await execGit(cwd, ["rm", "-f", "--",
|
|
12221
|
+
await execGit(cwd, ["rm", "-f", "--", path83]);
|
|
12222
12222
|
}
|
|
12223
12223
|
|
|
12224
12224
|
// src/commands/sessions/web/revertDiffFile.ts
|
|
12225
12225
|
async function revertDiffFile(req, res) {
|
|
12226
12226
|
const resolved = getFileTarget(req, res);
|
|
12227
12227
|
if (!resolved) return;
|
|
12228
|
-
const
|
|
12228
|
+
const path83 = relative3(repoRoot(resolved.cwd), resolved.target);
|
|
12229
12229
|
try {
|
|
12230
|
-
await revertPathChanges(resolved.cwd,
|
|
12231
|
-
respondJson(res, 200, { reverted:
|
|
12230
|
+
await revertPathChanges(resolved.cwd, path83);
|
|
12231
|
+
respondJson(res, 200, { reverted: path83 });
|
|
12232
12232
|
} catch (error) {
|
|
12233
12233
|
respondJson(res, 500, {
|
|
12234
12234
|
error: error instanceof Error ? error.message : "Failed to revert file"
|
|
@@ -12250,7 +12250,7 @@ async function readJsonBody(req) {
|
|
|
12250
12250
|
function requestedPaths(body) {
|
|
12251
12251
|
const paths = body.paths;
|
|
12252
12252
|
if (!Array.isArray(paths)) return null;
|
|
12253
|
-
if (paths.some((
|
|
12253
|
+
if (paths.some((path83) => typeof path83 !== "string")) return null;
|
|
12254
12254
|
return paths;
|
|
12255
12255
|
}
|
|
12256
12256
|
async function revertDiffPaths(req, res) {
|
|
@@ -12270,10 +12270,10 @@ async function revertDiffPaths(req, res) {
|
|
|
12270
12270
|
const root = repoRoot(cwd);
|
|
12271
12271
|
const reverted = [];
|
|
12272
12272
|
const failed2 = [];
|
|
12273
|
-
for (const
|
|
12274
|
-
const target = resolveWithinCwd(cwd,
|
|
12273
|
+
for (const path83 of paths) {
|
|
12274
|
+
const target = resolveWithinCwd(cwd, path83);
|
|
12275
12275
|
if (!target) {
|
|
12276
|
-
failed2.push({ path:
|
|
12276
|
+
failed2.push({ path: path83, error: "Path outside cwd" });
|
|
12277
12277
|
continue;
|
|
12278
12278
|
}
|
|
12279
12279
|
const relativePath = relative4(root, target);
|
|
@@ -12363,11 +12363,11 @@ function coerceStructuredConfigValue(key, raw) {
|
|
|
12363
12363
|
};
|
|
12364
12364
|
}
|
|
12365
12365
|
function formatIssue(key, issue) {
|
|
12366
|
-
const
|
|
12366
|
+
const path83 = formatConfigPath([
|
|
12367
12367
|
{ kind: "key", name: key },
|
|
12368
12368
|
...issue.path.map(toSegment)
|
|
12369
12369
|
]);
|
|
12370
|
-
return `${
|
|
12370
|
+
return `${path83}: ${issue.message}`;
|
|
12371
12371
|
}
|
|
12372
12372
|
function toSegment(part) {
|
|
12373
12373
|
return typeof part === "number" ? { kind: "index", index: part } : { kind: "key", name: String(part) };
|
|
@@ -12462,9 +12462,9 @@ function coerceUnion(key, raw, types) {
|
|
|
12462
12462
|
}
|
|
12463
12463
|
|
|
12464
12464
|
// src/shared/valueAtConfigPath.ts
|
|
12465
|
-
function valueAtConfigPath(value,
|
|
12465
|
+
function valueAtConfigPath(value, path83) {
|
|
12466
12466
|
let current = value;
|
|
12467
|
-
for (const key of
|
|
12467
|
+
for (const key of path83) {
|
|
12468
12468
|
if (typeof key === "number") {
|
|
12469
12469
|
if (!Array.isArray(current)) return void 0;
|
|
12470
12470
|
current = current[key];
|
|
@@ -12481,7 +12481,7 @@ function restoreConfigSecrets(value, stored, node) {
|
|
|
12481
12481
|
return mapConfigSecrets(
|
|
12482
12482
|
value,
|
|
12483
12483
|
node,
|
|
12484
|
-
(secret,
|
|
12484
|
+
(secret, path83) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path83) : secret
|
|
12485
12485
|
);
|
|
12486
12486
|
}
|
|
12487
12487
|
|
|
@@ -12530,8 +12530,8 @@ function stepIntoNested(container, key, nextKey) {
|
|
|
12530
12530
|
}
|
|
12531
12531
|
return ensureObject(container, resolved);
|
|
12532
12532
|
}
|
|
12533
|
-
function setNestedValue(obj,
|
|
12534
|
-
const keys =
|
|
12533
|
+
function setNestedValue(obj, path83, value) {
|
|
12534
|
+
const keys = path83.split(".");
|
|
12535
12535
|
const result = { ...obj };
|
|
12536
12536
|
let current = result;
|
|
12537
12537
|
for (let i = 0; i < keys.length - 1; i++) {
|
|
@@ -12558,8 +12558,8 @@ function formatIssue2(issue, key) {
|
|
|
12558
12558
|
return issue.keys.map(
|
|
12559
12559
|
(unrecognized) => `${[...issue.path, unrecognized].join(".")}: Unrecognized key`
|
|
12560
12560
|
);
|
|
12561
|
-
const
|
|
12562
|
-
return [`${
|
|
12561
|
+
const path83 = issue.path.length > 0 ? issue.path.join(".") : key;
|
|
12562
|
+
return [`${path83}: ${issue.message}`];
|
|
12563
12563
|
}
|
|
12564
12564
|
|
|
12565
12565
|
// src/commands/config/applyConfigSet.ts
|
|
@@ -12816,8 +12816,8 @@ function removeAt(container, keys) {
|
|
|
12816
12816
|
}
|
|
12817
12817
|
return removeFromChild(container, key, rest);
|
|
12818
12818
|
}
|
|
12819
|
-
function unsetNestedValue(obj,
|
|
12820
|
-
const { container, removed } = removeAt(obj,
|
|
12819
|
+
function unsetNestedValue(obj, path83) {
|
|
12820
|
+
const { container, removed } = removeAt(obj, path83.split("."));
|
|
12821
12821
|
return { config: container, removed };
|
|
12822
12822
|
}
|
|
12823
12823
|
|
|
@@ -13930,9 +13930,9 @@ function originToSshUrl(origin) {
|
|
|
13930
13930
|
const firstSlash = origin.indexOf("/");
|
|
13931
13931
|
if (firstSlash <= 0) return null;
|
|
13932
13932
|
const host = origin.slice(0, firstSlash);
|
|
13933
|
-
const
|
|
13934
|
-
if (!
|
|
13935
|
-
return `git@${host}:${
|
|
13933
|
+
const path83 = origin.slice(firstSlash + 1);
|
|
13934
|
+
if (!path83) return null;
|
|
13935
|
+
return `git@${host}:${path83}.git`;
|
|
13936
13936
|
}
|
|
13937
13937
|
|
|
13938
13938
|
// src/commands/backlog/cloneRepo.ts
|
|
@@ -16960,9 +16960,9 @@ var __dirname4 = dirname23(__filename3);
|
|
|
16960
16960
|
function packageRoot() {
|
|
16961
16961
|
return __dirname4;
|
|
16962
16962
|
}
|
|
16963
|
-
function readLines(
|
|
16964
|
-
if (!existsSync36(
|
|
16965
|
-
return readFileSync25(
|
|
16963
|
+
function readLines(path83) {
|
|
16964
|
+
if (!existsSync36(path83)) return [];
|
|
16965
|
+
return readFileSync25(path83, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
16966
16966
|
}
|
|
16967
16967
|
var cachedReads;
|
|
16968
16968
|
var cachedWrites;
|
|
@@ -17483,14 +17483,14 @@ function showProgress(p, label2) {
|
|
|
17483
17483
|
const pct = Math.round(p.done / p.total * 100);
|
|
17484
17484
|
process.stderr.write(`\r\x1B[K[${pct}%] Scanning ${label2}...`);
|
|
17485
17485
|
}
|
|
17486
|
-
async function resolveCommand(cli,
|
|
17487
|
-
showProgress(p,
|
|
17488
|
-
const subHelp = await runHelp([cli, ...
|
|
17486
|
+
async function resolveCommand(cli, path83, description, depth, p) {
|
|
17487
|
+
showProgress(p, path83.join(" "));
|
|
17488
|
+
const subHelp = await runHelp([cli, ...path83]);
|
|
17489
17489
|
if (!subHelp || !hasSubcommands(subHelp)) {
|
|
17490
|
-
return [{ path:
|
|
17490
|
+
return [{ path: path83, description }];
|
|
17491
17491
|
}
|
|
17492
|
-
const children = await discoverAt(cli,
|
|
17493
|
-
return children.length > 0 ? children : [{ path:
|
|
17492
|
+
const children = await discoverAt(cli, path83, depth + 1, p);
|
|
17493
|
+
return children.length > 0 ? children : [{ path: path83, description }];
|
|
17494
17494
|
}
|
|
17495
17495
|
async function discoverAt(cli, parentPath, depth, p) {
|
|
17496
17496
|
if (depth > SAFETY_DEPTH) return [];
|
|
@@ -17638,9 +17638,9 @@ function logPath(cli) {
|
|
|
17638
17638
|
return join39(homedir17(), ".assist", `cli-discover-${safeName}.log`);
|
|
17639
17639
|
}
|
|
17640
17640
|
function readCache(cli) {
|
|
17641
|
-
const
|
|
17642
|
-
if (!existsSync38(
|
|
17643
|
-
return readFileSync27(
|
|
17641
|
+
const path83 = logPath(cli);
|
|
17642
|
+
if (!existsSync38(path83)) return void 0;
|
|
17643
|
+
return readFileSync27(path83, "utf8");
|
|
17644
17644
|
}
|
|
17645
17645
|
function writeCache(cli, output) {
|
|
17646
17646
|
const dir = join39(homedir17(), ".assist");
|
|
@@ -17800,9 +17800,9 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
17800
17800
|
}
|
|
17801
17801
|
const cutoff = Date.now() - STALE_AFTER_MS;
|
|
17802
17802
|
for (const entry of entries) {
|
|
17803
|
-
const
|
|
17803
|
+
const path83 = join41(dir, entry);
|
|
17804
17804
|
try {
|
|
17805
|
-
if (statSync6(
|
|
17805
|
+
if (statSync6(path83).mtimeMs < cutoff) unlinkSync7(path83);
|
|
17806
17806
|
} catch {
|
|
17807
17807
|
continue;
|
|
17808
17808
|
}
|
|
@@ -17812,10 +17812,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
17812
17812
|
// src/commands/codeComment/readPinState.ts
|
|
17813
17813
|
import { existsSync as existsSync39, readFileSync as readFileSync28 } from "fs";
|
|
17814
17814
|
function readPinState(pin) {
|
|
17815
|
-
const
|
|
17816
|
-
if (!existsSync39(
|
|
17815
|
+
const path83 = getPinStatePath(pin);
|
|
17816
|
+
if (!existsSync39(path83)) return void 0;
|
|
17817
17817
|
try {
|
|
17818
|
-
const state = JSON.parse(readFileSync28(
|
|
17818
|
+
const state = JSON.parse(readFileSync28(path83, "utf8"));
|
|
17819
17819
|
if (state.pin !== pin) return void 0;
|
|
17820
17820
|
return state;
|
|
17821
17821
|
} catch {
|
|
@@ -18954,11 +18954,11 @@ async function loadPath(source) {
|
|
|
18954
18954
|
}
|
|
18955
18955
|
}
|
|
18956
18956
|
async function criteriaExtension() {
|
|
18957
|
-
const
|
|
18957
|
+
const path83 = await loadPath(criteriaExtensionDir());
|
|
18958
18958
|
console.log(
|
|
18959
18959
|
chalk139.bold("acceptance criteria outliner \u2014 GitHub browser extension")
|
|
18960
18960
|
);
|
|
18961
|
-
console.log(chalk139.dim(`load the unpacked extension from ${
|
|
18961
|
+
console.log(chalk139.dim(`load the unpacked extension from ${path83}`));
|
|
18962
18962
|
}
|
|
18963
18963
|
|
|
18964
18964
|
// src/commands/registerCriteriaExtension.ts
|
|
@@ -19051,10 +19051,10 @@ function getMigrationApprovalPath(migrationId) {
|
|
|
19051
19051
|
// src/commands/dbMigration/readMigrationPinState.ts
|
|
19052
19052
|
import { existsSync as existsSync42, readFileSync as readFileSync30 } from "fs";
|
|
19053
19053
|
function readMigrationPinState(pin) {
|
|
19054
|
-
const
|
|
19055
|
-
if (!existsSync42(
|
|
19054
|
+
const path83 = getMigrationPinPath(pin);
|
|
19055
|
+
if (!existsSync42(path83)) return void 0;
|
|
19056
19056
|
try {
|
|
19057
|
-
const state = JSON.parse(readFileSync30(
|
|
19057
|
+
const state = JSON.parse(readFileSync30(path83, "utf8"));
|
|
19058
19058
|
if (state.pin !== pin) return void 0;
|
|
19059
19059
|
if (!Number.isInteger(state.migrationId)) return void 0;
|
|
19060
19060
|
return state;
|
|
@@ -20484,10 +20484,10 @@ function decideCommentGuard(input, existingContent) {
|
|
|
20484
20484
|
import { existsSync as existsSync48, unlinkSync as unlinkSync11 } from "fs";
|
|
20485
20485
|
function consumeMigrationApproval(migrationId) {
|
|
20486
20486
|
sweepRestrictedDir();
|
|
20487
|
-
const
|
|
20488
|
-
if (!existsSync48(
|
|
20487
|
+
const path83 = getMigrationApprovalPath(migrationId);
|
|
20488
|
+
if (!existsSync48(path83)) return false;
|
|
20489
20489
|
try {
|
|
20490
|
-
unlinkSync11(
|
|
20490
|
+
unlinkSync11(path83);
|
|
20491
20491
|
return true;
|
|
20492
20492
|
} catch {
|
|
20493
20493
|
return false;
|
|
@@ -22009,15 +22009,15 @@ function renderNodes(nodes, indent3) {
|
|
|
22009
22009
|
function isListNode(node) {
|
|
22010
22010
|
return node.type === "orderedList" || node.type === "bulletList";
|
|
22011
22011
|
}
|
|
22012
|
-
function renderListChild(child, indent3,
|
|
22012
|
+
function renderListChild(child, indent3, pad2, marker2, isFirst) {
|
|
22013
22013
|
if (isListNode(child)) return renderNodes([child], indent3 + 1);
|
|
22014
22014
|
if (child.type !== "paragraph") return renderNode(child, indent3);
|
|
22015
22015
|
const text18 = renderChildren(child, indent3);
|
|
22016
|
-
return isFirst ? `${
|
|
22016
|
+
return isFirst ? `${pad2}${marker2} ${text18}` : `${pad2} ${text18}`;
|
|
22017
22017
|
}
|
|
22018
22018
|
function renderListItem(node, indent3, marker2) {
|
|
22019
|
-
const
|
|
22020
|
-
return (node.content ?? []).map((child, i) => renderListChild(child, indent3,
|
|
22019
|
+
const pad2 = " ".repeat(indent3);
|
|
22020
|
+
return (node.content ?? []).map((child, i) => renderListChild(child, indent3, pad2, marker2, i === 0)).join("\n");
|
|
22021
22021
|
}
|
|
22022
22022
|
function adfToText(doc) {
|
|
22023
22023
|
return renderNodes([doc], 0);
|
|
@@ -22181,11 +22181,11 @@ function recentDaemonLogLines() {
|
|
|
22181
22181
|
// src/commands/sessions/daemon/worktree/canonicalTreePath.ts
|
|
22182
22182
|
import { realpathSync as realpathSync2 } from "fs";
|
|
22183
22183
|
import { resolve as resolve14 } from "path";
|
|
22184
|
-
function canonicalTreePath(
|
|
22184
|
+
function canonicalTreePath(path83) {
|
|
22185
22185
|
try {
|
|
22186
|
-
return realpathSync2(
|
|
22186
|
+
return realpathSync2(path83);
|
|
22187
22187
|
} catch {
|
|
22188
|
-
return resolve14(
|
|
22188
|
+
return resolve14(path83);
|
|
22189
22189
|
}
|
|
22190
22190
|
}
|
|
22191
22191
|
|
|
@@ -22238,22 +22238,22 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
|
22238
22238
|
const registered = new Set(listWorktreePaths(clone));
|
|
22239
22239
|
const branches = new Set(listLocalBranches(clone));
|
|
22240
22240
|
const isTaken = (candidate) => registered.has(candidate) || existsSync51(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename16(candidate));
|
|
22241
|
-
const
|
|
22241
|
+
const path83 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
|
|
22242
22242
|
const start3 = worktreeStartPoint(clone, strategy.trunk);
|
|
22243
22243
|
gitSync(clone, [
|
|
22244
22244
|
"worktree",
|
|
22245
22245
|
"add",
|
|
22246
22246
|
start3.track ? "--track" : "--no-track",
|
|
22247
22247
|
"-b",
|
|
22248
|
-
basename16(
|
|
22249
|
-
|
|
22248
|
+
basename16(path83),
|
|
22249
|
+
path83,
|
|
22250
22250
|
start3.ref
|
|
22251
22251
|
]);
|
|
22252
|
-
recordWorktree(
|
|
22252
|
+
recordWorktree(path83, clone, getCurrentOrigin(clone));
|
|
22253
22253
|
daemonLog(
|
|
22254
|
-
start3.track ? `worktree allocated ${
|
|
22254
|
+
start3.track ? `worktree allocated ${path83} (branch ${basename16(path83)} tracking ${start3.ref}) for clone ${clone}` : `worktree allocated ${path83} (branch ${basename16(path83)} off ${start3.ref}, no mainline tracking) for clone ${clone}`
|
|
22255
22255
|
);
|
|
22256
|
-
return
|
|
22256
|
+
return path83;
|
|
22257
22257
|
}
|
|
22258
22258
|
|
|
22259
22259
|
// src/commands/sessions/daemon/worktree/keptInTree.ts
|
|
@@ -22394,13 +22394,13 @@ function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
|
|
|
22394
22394
|
if (forcedSpill) daemonLog(forcedSpill);
|
|
22395
22395
|
else if (reusesClone(clone, boundTreeRoots2, reuse))
|
|
22396
22396
|
return { cwd: clone, kind: "primary", created: false, clone };
|
|
22397
|
-
const
|
|
22397
|
+
const path83 = createWorktree(
|
|
22398
22398
|
clone,
|
|
22399
22399
|
{ root: cfg.root, trunk: cfg.trunk },
|
|
22400
22400
|
boundTreeRoots2,
|
|
22401
22401
|
options2.replacesTree
|
|
22402
22402
|
);
|
|
22403
|
-
return { cwd:
|
|
22403
|
+
return { cwd: path83, kind: "worktree", created: true, clone };
|
|
22404
22404
|
}
|
|
22405
22405
|
|
|
22406
22406
|
// src/commands/sessions/daemon/describePersistedSession.ts
|
|
@@ -22731,13 +22731,13 @@ function worktreeHoldingBranch(cwd, branch2) {
|
|
|
22731
22731
|
const listing = gitSyncOrNull(cwd, ["worktree", "list", "--porcelain"]);
|
|
22732
22732
|
if (!listing) return null;
|
|
22733
22733
|
const here = gitSyncOrNull(cwd, ["rev-parse", "--show-toplevel"]);
|
|
22734
|
-
let
|
|
22734
|
+
let path83 = null;
|
|
22735
22735
|
for (const line of listing.split("\n")) {
|
|
22736
22736
|
const trimmed = line.trim();
|
|
22737
22737
|
if (trimmed.startsWith("worktree "))
|
|
22738
|
-
|
|
22738
|
+
path83 = trimmed.slice("worktree ".length).trim();
|
|
22739
22739
|
else if (trimmed === `branch refs/heads/${branch2}`)
|
|
22740
|
-
return
|
|
22740
|
+
return path83 && path83 !== here ? path83 : null;
|
|
22741
22741
|
}
|
|
22742
22742
|
return null;
|
|
22743
22743
|
}
|
|
@@ -23779,9 +23779,9 @@ function parseRscRows(flight) {
|
|
|
23779
23779
|
}
|
|
23780
23780
|
function makeRscResolver(rows) {
|
|
23781
23781
|
return (ref) => {
|
|
23782
|
-
const [id, ...
|
|
23782
|
+
const [id, ...path83] = ref.slice(1).replace(/^[L@]/, "").split(":");
|
|
23783
23783
|
let v = rows[id];
|
|
23784
|
-
for (const key of
|
|
23784
|
+
for (const key of path83) {
|
|
23785
23785
|
if (v == null || typeof v !== "object") return void 0;
|
|
23786
23786
|
v = v[key];
|
|
23787
23787
|
}
|
|
@@ -24484,16 +24484,16 @@ function validateLine(line) {
|
|
|
24484
24484
|
process.exit(1);
|
|
24485
24485
|
}
|
|
24486
24486
|
}
|
|
24487
|
-
async function comment2(
|
|
24487
|
+
async function comment2(path83, line, body, startLine) {
|
|
24488
24488
|
validateBody(body);
|
|
24489
24489
|
validateLine(line);
|
|
24490
24490
|
if (startLine !== void 0) validateLine(startLine);
|
|
24491
24491
|
const range = startLine !== void 0 ? `${startLine}-${line}` : `${line}`;
|
|
24492
|
-
await reviewProposedPrComment(`Comment on ${
|
|
24492
|
+
await reviewProposedPrComment(`Comment on ${path83}:${range}`, body, null);
|
|
24493
24493
|
try {
|
|
24494
24494
|
const prId = getCurrentPrNodeId();
|
|
24495
|
-
postReviewComment({ prId, body, path:
|
|
24496
|
-
console.log(`Added review comment on ${
|
|
24495
|
+
postReviewComment({ prId, body, path: path83, line, startLine });
|
|
24496
|
+
console.log(`Added review comment on ${path83}:${range}`);
|
|
24497
24497
|
} catch (error) {
|
|
24498
24498
|
if (isGhNotInstalled(error)) {
|
|
24499
24499
|
console.error("Error: GitHub CLI (gh) is not installed.");
|
|
@@ -25695,9 +25695,9 @@ function registerPrsComments(prsCommand) {
|
|
|
25695
25695
|
});
|
|
25696
25696
|
prsCommand.command("comment <path> <line> <body>").description(
|
|
25697
25697
|
"Add a line comment to the pending review (body of - reads it from stdin)"
|
|
25698
|
-
).action(async (
|
|
25698
|
+
).action(async (path83, line, body) => {
|
|
25699
25699
|
await comment2(
|
|
25700
|
-
|
|
25700
|
+
path83,
|
|
25701
25701
|
Number.parseInt(line, 10),
|
|
25702
25702
|
await readBodyArgument(body)
|
|
25703
25703
|
);
|
|
@@ -26161,10 +26161,10 @@ function resolveOpSecret(reference) {
|
|
|
26161
26161
|
}
|
|
26162
26162
|
|
|
26163
26163
|
// src/commands/ravendb/ravenFetch.ts
|
|
26164
|
-
async function ravenFetch(connection,
|
|
26164
|
+
async function ravenFetch(connection, path83) {
|
|
26165
26165
|
const apiKey = resolveOpSecret(connection.apiKeyRef);
|
|
26166
26166
|
let accessToken = await getAccessToken(apiKey);
|
|
26167
|
-
const url = `${connection.url}${
|
|
26167
|
+
const url = `${connection.url}${path83}`;
|
|
26168
26168
|
const headers = {
|
|
26169
26169
|
Authorization: `Bearer ${accessToken}`,
|
|
26170
26170
|
"Content-Type": "application/json"
|
|
@@ -26254,16 +26254,16 @@ import chalk191 from "chalk";
|
|
|
26254
26254
|
// src/commands/ravendb/buildQueryPath.ts
|
|
26255
26255
|
function buildQueryPath(opts) {
|
|
26256
26256
|
const db = encodeURIComponent(opts.db);
|
|
26257
|
-
let
|
|
26257
|
+
let path83;
|
|
26258
26258
|
if (opts.collection) {
|
|
26259
|
-
|
|
26259
|
+
path83 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
|
|
26260
26260
|
} else {
|
|
26261
|
-
|
|
26261
|
+
path83 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
|
|
26262
26262
|
}
|
|
26263
26263
|
if (opts.query) {
|
|
26264
|
-
|
|
26264
|
+
path83 += `&query=${encodeURIComponent(opts.query)}`;
|
|
26265
26265
|
}
|
|
26266
|
-
return
|
|
26266
|
+
return path83;
|
|
26267
26267
|
}
|
|
26268
26268
|
|
|
26269
26269
|
// src/commands/ravendb/fetchAllPages.ts
|
|
@@ -26272,7 +26272,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
26272
26272
|
let start3 = 0;
|
|
26273
26273
|
while (true) {
|
|
26274
26274
|
const effectivePageSize = opts.limit !== void 0 ? Math.min(opts.pageSize, opts.limit - allResults.length) : opts.pageSize;
|
|
26275
|
-
const
|
|
26275
|
+
const path83 = buildQueryPath({
|
|
26276
26276
|
db: connection.database,
|
|
26277
26277
|
collection: opts.collection,
|
|
26278
26278
|
start: start3,
|
|
@@ -26280,7 +26280,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
26280
26280
|
sort: opts.sort,
|
|
26281
26281
|
query: opts.query
|
|
26282
26282
|
});
|
|
26283
|
-
const data = await ravenFetch(connection,
|
|
26283
|
+
const data = await ravenFetch(connection, path83);
|
|
26284
26284
|
const results = data.Results ?? [];
|
|
26285
26285
|
const totalResults = data.TotalResults ?? 0;
|
|
26286
26286
|
if (results.length === 0) break;
|
|
@@ -28888,8 +28888,8 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
|
|
|
28888
28888
|
// src/commands/review/prepareReviewDir.ts
|
|
28889
28889
|
import { existsSync as existsSync57, mkdirSync as mkdirSync21, unlinkSync as unlinkSync17, writeFileSync as writeFileSync38 } from "fs";
|
|
28890
28890
|
function clearReviewFiles(paths) {
|
|
28891
|
-
for (const
|
|
28892
|
-
if (existsSync57(
|
|
28891
|
+
for (const path83 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
28892
|
+
if (existsSync57(path83)) unlinkSync17(path83);
|
|
28893
28893
|
}
|
|
28894
28894
|
}
|
|
28895
28895
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -29937,8 +29937,99 @@ function registerReview(program2) {
|
|
|
29937
29937
|
);
|
|
29938
29938
|
}
|
|
29939
29939
|
|
|
29940
|
+
// src/commands/rules/listRules.ts
|
|
29941
|
+
import path66 from "path";
|
|
29942
|
+
import chalk207 from "chalk";
|
|
29943
|
+
|
|
29944
|
+
// src/commands/rules/readScopedRules.ts
|
|
29945
|
+
import { existsSync as existsSync61, readFileSync as readFileSync46 } from "fs";
|
|
29946
|
+
import path65 from "path";
|
|
29947
|
+
|
|
29948
|
+
// src/commands/rules/parseRulesSection.ts
|
|
29949
|
+
var RULES_HEADING = /^##\s+rules\s*$/i;
|
|
29950
|
+
var SECTION_END = /^#{1,2}\s/;
|
|
29951
|
+
var RULE_BULLET = /^\s*[-*]\s+\*\*\s*([^*]+?)\s*\*\*\s*(?:[—–:-]\s*)?(.*)$/;
|
|
29952
|
+
function parseRulesSection(content) {
|
|
29953
|
+
const lines2 = content.split(/\r?\n/);
|
|
29954
|
+
const start3 = lines2.findIndex((line) => RULES_HEADING.test(line));
|
|
29955
|
+
if (start3 === -1) return [];
|
|
29956
|
+
const rules3 = [];
|
|
29957
|
+
for (const line of lines2.slice(start3 + 1)) {
|
|
29958
|
+
if (SECTION_END.test(line)) break;
|
|
29959
|
+
const match = RULE_BULLET.exec(line);
|
|
29960
|
+
if (!match) continue;
|
|
29961
|
+
const code = match[1].trim();
|
|
29962
|
+
const text18 = match[2].trim();
|
|
29963
|
+
if (code === "" || text18 === "") continue;
|
|
29964
|
+
rules3.push({ code, text: text18 });
|
|
29965
|
+
}
|
|
29966
|
+
return rules3;
|
|
29967
|
+
}
|
|
29968
|
+
|
|
29969
|
+
// src/commands/rules/scopeDirectory.ts
|
|
29970
|
+
import { existsSync as existsSync60, statSync as statSync10 } from "fs";
|
|
29971
|
+
import path64 from "path";
|
|
29972
|
+
function scopeDirectory(target) {
|
|
29973
|
+
const resolved = path64.resolve(target);
|
|
29974
|
+
return existsSync60(resolved) && statSync10(resolved).isDirectory() ? resolved : path64.dirname(resolved);
|
|
29975
|
+
}
|
|
29976
|
+
|
|
29977
|
+
// src/commands/rules/readScopedRules.ts
|
|
29978
|
+
function scopedClaudeFiles(target) {
|
|
29979
|
+
const startDir = scopeDirectory(target);
|
|
29980
|
+
const root = findRepoRoot(startDir) ?? startDir;
|
|
29981
|
+
const files = [];
|
|
29982
|
+
let current = startDir;
|
|
29983
|
+
while (true) {
|
|
29984
|
+
const candidate = path65.join(current, "CLAUDE.md");
|
|
29985
|
+
if (existsSync61(candidate)) files.push(candidate);
|
|
29986
|
+
if (current === root || current === path65.dirname(current)) break;
|
|
29987
|
+
current = path65.dirname(current);
|
|
29988
|
+
}
|
|
29989
|
+
return files;
|
|
29990
|
+
}
|
|
29991
|
+
function readScopedRules(target) {
|
|
29992
|
+
return scopedClaudeFiles(target).flatMap(
|
|
29993
|
+
(source) => parseRulesSection(readFileSync46(source, "utf8")).map((rule) => ({
|
|
29994
|
+
...rule,
|
|
29995
|
+
source
|
|
29996
|
+
}))
|
|
29997
|
+
);
|
|
29998
|
+
}
|
|
29999
|
+
|
|
30000
|
+
// src/commands/rules/listRules.ts
|
|
30001
|
+
function listRules(target) {
|
|
30002
|
+
const resolved = path66.resolve(target ?? process.cwd());
|
|
30003
|
+
const rules3 = readScopedRules(resolved);
|
|
30004
|
+
if (rules3.length === 0) {
|
|
30005
|
+
const label2 = path66.relative(process.cwd(), resolved) || ".";
|
|
30006
|
+
console.log(chalk207.gray(`No rules in scope for ${label2}`));
|
|
30007
|
+
return;
|
|
30008
|
+
}
|
|
30009
|
+
const base = findRepoRoot(scopeDirectory(resolved));
|
|
30010
|
+
const width = Math.max(...rules3.map((rule) => rule.code.length));
|
|
30011
|
+
let shown;
|
|
30012
|
+
for (const rule of rules3) {
|
|
30013
|
+
if (rule.source !== shown) {
|
|
30014
|
+
shown = rule.source;
|
|
30015
|
+
console.log(
|
|
30016
|
+
chalk207.dim(base ? path66.relative(base, rule.source) : rule.source)
|
|
30017
|
+
);
|
|
30018
|
+
}
|
|
30019
|
+
console.log(` ${chalk207.cyan(rule.code.padEnd(width))} ${rule.text}`);
|
|
30020
|
+
}
|
|
30021
|
+
}
|
|
30022
|
+
|
|
30023
|
+
// src/commands/registerRules.ts
|
|
30024
|
+
function registerRules(program2) {
|
|
30025
|
+
const rulesCommand = program2.command("rules").description("Read the CLAUDE.md rules in scope for a path");
|
|
30026
|
+
rulesCommand.command("list [path]").description(
|
|
30027
|
+
"List the rules from the `## Rules` section of every CLAUDE.md from a path's directory up to the repo root (default: cwd)"
|
|
30028
|
+
).action((target) => listRules(target));
|
|
30029
|
+
}
|
|
30030
|
+
|
|
29940
30031
|
// src/commands/seq/seqAuth.ts
|
|
29941
|
-
import
|
|
30032
|
+
import chalk209 from "chalk";
|
|
29942
30033
|
|
|
29943
30034
|
// src/commands/seq/loadConnections.ts
|
|
29944
30035
|
function loadConnections2() {
|
|
@@ -29967,10 +30058,10 @@ function setDefaultConnection(name) {
|
|
|
29967
30058
|
}
|
|
29968
30059
|
|
|
29969
30060
|
// src/shared/assertUniqueName.ts
|
|
29970
|
-
import
|
|
30061
|
+
import chalk208 from "chalk";
|
|
29971
30062
|
function assertUniqueName(existingNames, name) {
|
|
29972
30063
|
if (existingNames.includes(name)) {
|
|
29973
|
-
console.error(
|
|
30064
|
+
console.error(chalk208.red(`Connection "${name}" already exists.`));
|
|
29974
30065
|
process.exit(1);
|
|
29975
30066
|
}
|
|
29976
30067
|
}
|
|
@@ -29988,18 +30079,18 @@ async function promptConnection2(existingNames) {
|
|
|
29988
30079
|
var seqAuth = createConnectionAuth({
|
|
29989
30080
|
load: loadConnections2,
|
|
29990
30081
|
save: saveConnections2,
|
|
29991
|
-
format: (c) => `${
|
|
30082
|
+
format: (c) => `${chalk209.bold(c.name)} ${c.url}`,
|
|
29992
30083
|
promptNew: promptConnection2,
|
|
29993
30084
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
29994
30085
|
});
|
|
29995
30086
|
|
|
29996
30087
|
// src/commands/seq/seqQuery.ts
|
|
29997
|
-
import
|
|
30088
|
+
import chalk213 from "chalk";
|
|
29998
30089
|
|
|
29999
30090
|
// src/commands/seq/fetchSeq.ts
|
|
30000
|
-
import
|
|
30001
|
-
async function fetchSeq(conn,
|
|
30002
|
-
const url = `${conn.url}${
|
|
30091
|
+
import chalk210 from "chalk";
|
|
30092
|
+
async function fetchSeq(conn, path83, params) {
|
|
30093
|
+
const url = `${conn.url}${path83}?${params}`;
|
|
30003
30094
|
const response = await fetch(url, {
|
|
30004
30095
|
headers: {
|
|
30005
30096
|
Accept: "application/json",
|
|
@@ -30008,7 +30099,7 @@ async function fetchSeq(conn, path80, params) {
|
|
|
30008
30099
|
});
|
|
30009
30100
|
if (!response.ok) {
|
|
30010
30101
|
const body = await response.text();
|
|
30011
|
-
console.error(
|
|
30102
|
+
console.error(chalk210.red(`Seq returned ${response.status}: ${body}`));
|
|
30012
30103
|
process.exit(1);
|
|
30013
30104
|
}
|
|
30014
30105
|
return response;
|
|
@@ -30067,23 +30158,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
30067
30158
|
}
|
|
30068
30159
|
|
|
30069
30160
|
// src/commands/seq/formatEvent.ts
|
|
30070
|
-
import
|
|
30161
|
+
import chalk211 from "chalk";
|
|
30071
30162
|
function levelColor(level) {
|
|
30072
30163
|
switch (level) {
|
|
30073
30164
|
case "Fatal":
|
|
30074
|
-
return
|
|
30165
|
+
return chalk211.bgRed.white;
|
|
30075
30166
|
case "Error":
|
|
30076
|
-
return
|
|
30167
|
+
return chalk211.red;
|
|
30077
30168
|
case "Warning":
|
|
30078
|
-
return
|
|
30169
|
+
return chalk211.yellow;
|
|
30079
30170
|
case "Information":
|
|
30080
|
-
return
|
|
30171
|
+
return chalk211.cyan;
|
|
30081
30172
|
case "Debug":
|
|
30082
|
-
return
|
|
30173
|
+
return chalk211.gray;
|
|
30083
30174
|
case "Verbose":
|
|
30084
|
-
return
|
|
30175
|
+
return chalk211.dim;
|
|
30085
30176
|
default:
|
|
30086
|
-
return
|
|
30177
|
+
return chalk211.white;
|
|
30087
30178
|
}
|
|
30088
30179
|
}
|
|
30089
30180
|
function levelAbbrev(level) {
|
|
@@ -30124,12 +30215,12 @@ function formatTimestamp(iso) {
|
|
|
30124
30215
|
function formatEvent(event) {
|
|
30125
30216
|
const color = levelColor(event.Level);
|
|
30126
30217
|
const abbrev = levelAbbrev(event.Level);
|
|
30127
|
-
const ts8 =
|
|
30218
|
+
const ts8 = chalk211.dim(formatTimestamp(event.Timestamp));
|
|
30128
30219
|
const msg = renderMessage(event);
|
|
30129
30220
|
const lines2 = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
30130
30221
|
if (event.Exception) {
|
|
30131
30222
|
for (const line of event.Exception.split("\n")) {
|
|
30132
|
-
lines2.push(
|
|
30223
|
+
lines2.push(chalk211.red(` ${line}`));
|
|
30133
30224
|
}
|
|
30134
30225
|
}
|
|
30135
30226
|
return lines2.join("\n");
|
|
@@ -30162,11 +30253,11 @@ function rejectTimestampFilter(filter) {
|
|
|
30162
30253
|
}
|
|
30163
30254
|
|
|
30164
30255
|
// src/shared/resolveNamedConnection.ts
|
|
30165
|
-
import
|
|
30256
|
+
import chalk212 from "chalk";
|
|
30166
30257
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
30167
30258
|
if (connections.length === 0) {
|
|
30168
30259
|
console.error(
|
|
30169
|
-
|
|
30260
|
+
chalk212.red(
|
|
30170
30261
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
30171
30262
|
)
|
|
30172
30263
|
);
|
|
@@ -30175,7 +30266,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
30175
30266
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
30176
30267
|
const connection = connections.find((c) => c.name === target);
|
|
30177
30268
|
if (!connection) {
|
|
30178
|
-
console.error(
|
|
30269
|
+
console.error(chalk212.red(`${kind} connection "${target}" not found.`));
|
|
30179
30270
|
process.exit(1);
|
|
30180
30271
|
}
|
|
30181
30272
|
return connection;
|
|
@@ -30204,7 +30295,7 @@ async function seqQuery(filter, options2) {
|
|
|
30204
30295
|
new URLSearchParams({ filter, count: String(count8) })
|
|
30205
30296
|
);
|
|
30206
30297
|
if (events.length === 0) {
|
|
30207
|
-
console.log(
|
|
30298
|
+
console.log(chalk213.yellow("No events found."));
|
|
30208
30299
|
return;
|
|
30209
30300
|
}
|
|
30210
30301
|
if (options2.json) {
|
|
@@ -30215,11 +30306,11 @@ async function seqQuery(filter, options2) {
|
|
|
30215
30306
|
for (const event of chronological) {
|
|
30216
30307
|
console.log(formatEvent(event));
|
|
30217
30308
|
}
|
|
30218
|
-
console.log(
|
|
30309
|
+
console.log(chalk213.dim(`
|
|
30219
30310
|
${events.length} events`));
|
|
30220
30311
|
if (events.length >= count8) {
|
|
30221
30312
|
console.log(
|
|
30222
|
-
|
|
30313
|
+
chalk213.yellow(
|
|
30223
30314
|
`Results limited to ${count8}. Use --count to retrieve more.`
|
|
30224
30315
|
)
|
|
30225
30316
|
);
|
|
@@ -30227,10 +30318,10 @@ ${events.length} events`));
|
|
|
30227
30318
|
}
|
|
30228
30319
|
|
|
30229
30320
|
// src/shared/setNamedDefaultConnection.ts
|
|
30230
|
-
import
|
|
30321
|
+
import chalk214 from "chalk";
|
|
30231
30322
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
30232
30323
|
if (!connections.find((c) => c.name === name)) {
|
|
30233
|
-
console.error(
|
|
30324
|
+
console.error(chalk214.red(`Connection "${name}" not found.`));
|
|
30234
30325
|
process.exit(1);
|
|
30235
30326
|
}
|
|
30236
30327
|
setDefault(name);
|
|
@@ -30279,7 +30370,7 @@ function registerSignal(program2) {
|
|
|
30279
30370
|
}
|
|
30280
30371
|
|
|
30281
30372
|
// src/commands/sql/sqlAuth.ts
|
|
30282
|
-
import
|
|
30373
|
+
import chalk216 from "chalk";
|
|
30283
30374
|
|
|
30284
30375
|
// src/commands/sql/loadConnections.ts
|
|
30285
30376
|
function loadConnections3() {
|
|
@@ -30308,7 +30399,7 @@ function setDefaultConnection2(name) {
|
|
|
30308
30399
|
}
|
|
30309
30400
|
|
|
30310
30401
|
// src/commands/sql/promptConnection.ts
|
|
30311
|
-
import
|
|
30402
|
+
import chalk215 from "chalk";
|
|
30312
30403
|
async function promptConnection3(existingNames) {
|
|
30313
30404
|
const name = await promptInput("name", "Connection name:", "default");
|
|
30314
30405
|
assertUniqueName(existingNames, name);
|
|
@@ -30316,7 +30407,7 @@ async function promptConnection3(existingNames) {
|
|
|
30316
30407
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
30317
30408
|
const port = Number.parseInt(portStr, 10);
|
|
30318
30409
|
if (!Number.isFinite(port)) {
|
|
30319
|
-
console.error(
|
|
30410
|
+
console.error(chalk215.red(`Invalid port "${portStr}".`));
|
|
30320
30411
|
process.exit(1);
|
|
30321
30412
|
}
|
|
30322
30413
|
const user = await promptInput("user", "User:");
|
|
@@ -30329,13 +30420,13 @@ async function promptConnection3(existingNames) {
|
|
|
30329
30420
|
var sqlAuth = createConnectionAuth({
|
|
30330
30421
|
load: loadConnections3,
|
|
30331
30422
|
save: saveConnections3,
|
|
30332
|
-
format: (c) => `${
|
|
30423
|
+
format: (c) => `${chalk216.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
30333
30424
|
promptNew: promptConnection3,
|
|
30334
30425
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
30335
30426
|
});
|
|
30336
30427
|
|
|
30337
30428
|
// src/commands/sql/printTable.ts
|
|
30338
|
-
import
|
|
30429
|
+
import chalk217 from "chalk";
|
|
30339
30430
|
function formatCell(value) {
|
|
30340
30431
|
if (value === null || value === void 0) return "";
|
|
30341
30432
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -30344,7 +30435,7 @@ function formatCell(value) {
|
|
|
30344
30435
|
}
|
|
30345
30436
|
function printTable(rows) {
|
|
30346
30437
|
if (rows.length === 0) {
|
|
30347
|
-
console.log(
|
|
30438
|
+
console.log(chalk217.yellow("(no rows)"));
|
|
30348
30439
|
return;
|
|
30349
30440
|
}
|
|
30350
30441
|
const columns = Object.keys(rows[0]);
|
|
@@ -30352,13 +30443,13 @@ function printTable(rows) {
|
|
|
30352
30443
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
30353
30444
|
);
|
|
30354
30445
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
30355
|
-
console.log(
|
|
30356
|
-
console.log(
|
|
30446
|
+
console.log(chalk217.dim(header));
|
|
30447
|
+
console.log(chalk217.dim("-".repeat(header.length)));
|
|
30357
30448
|
for (const row of rows) {
|
|
30358
30449
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
30359
30450
|
console.log(line);
|
|
30360
30451
|
}
|
|
30361
|
-
console.log(
|
|
30452
|
+
console.log(chalk217.dim(`
|
|
30362
30453
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
30363
30454
|
}
|
|
30364
30455
|
|
|
@@ -30418,7 +30509,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
30418
30509
|
}
|
|
30419
30510
|
|
|
30420
30511
|
// src/commands/sql/sqlMutate.ts
|
|
30421
|
-
import
|
|
30512
|
+
import chalk218 from "chalk";
|
|
30422
30513
|
|
|
30423
30514
|
// src/commands/sql/isMutation.ts
|
|
30424
30515
|
var MUTATION_KEYWORDS = [
|
|
@@ -30452,7 +30543,7 @@ function isMutation(sql25) {
|
|
|
30452
30543
|
async function sqlMutate(query, connectionName) {
|
|
30453
30544
|
if (!isMutation(query)) {
|
|
30454
30545
|
console.error(
|
|
30455
|
-
|
|
30546
|
+
chalk218.red(
|
|
30456
30547
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
30457
30548
|
)
|
|
30458
30549
|
);
|
|
@@ -30462,18 +30553,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
30462
30553
|
const pool = await sqlConnect(conn);
|
|
30463
30554
|
try {
|
|
30464
30555
|
const result = await pool.request().query(query);
|
|
30465
|
-
console.log(
|
|
30556
|
+
console.log(chalk218.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
30466
30557
|
} finally {
|
|
30467
30558
|
await pool.close();
|
|
30468
30559
|
}
|
|
30469
30560
|
}
|
|
30470
30561
|
|
|
30471
30562
|
// src/commands/sql/sqlQuery.ts
|
|
30472
|
-
import
|
|
30563
|
+
import chalk219 from "chalk";
|
|
30473
30564
|
async function sqlQuery(query, connectionName) {
|
|
30474
30565
|
if (isMutation(query)) {
|
|
30475
30566
|
console.error(
|
|
30476
|
-
|
|
30567
|
+
chalk219.red(
|
|
30477
30568
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
30478
30569
|
)
|
|
30479
30570
|
);
|
|
@@ -30488,7 +30579,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
30488
30579
|
printTable(rows);
|
|
30489
30580
|
} else {
|
|
30490
30581
|
console.log(
|
|
30491
|
-
|
|
30582
|
+
chalk219.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
30492
30583
|
);
|
|
30493
30584
|
}
|
|
30494
30585
|
} finally {
|
|
@@ -30551,15 +30642,15 @@ function registerSql(program2) {
|
|
|
30551
30642
|
// src/commands/sync.ts
|
|
30552
30643
|
import * as fs48 from "fs";
|
|
30553
30644
|
import * as os5 from "os";
|
|
30554
|
-
import * as
|
|
30645
|
+
import * as path77 from "path";
|
|
30555
30646
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
30556
30647
|
|
|
30557
30648
|
// src/commands/sync/pruneCommands.ts
|
|
30558
|
-
import * as
|
|
30649
|
+
import * as path68 from "path";
|
|
30559
30650
|
|
|
30560
30651
|
// src/commands/sync/pruneTarget.ts
|
|
30561
30652
|
import * as fs40 from "fs";
|
|
30562
|
-
import * as
|
|
30653
|
+
import * as path67 from "path";
|
|
30563
30654
|
function pruneTarget(targetDir, keepNames, shape, options2) {
|
|
30564
30655
|
const result = {
|
|
30565
30656
|
orphans: [],
|
|
@@ -30577,7 +30668,7 @@ function pruneTarget(targetDir, keepNames, shape, options2) {
|
|
|
30577
30668
|
}
|
|
30578
30669
|
if (keep.has(name)) continue;
|
|
30579
30670
|
result.orphans.push(entry.name);
|
|
30580
|
-
const entryPath =
|
|
30671
|
+
const entryPath = path67.join(targetDir, entry.name);
|
|
30581
30672
|
const reason4 = shape.blockedBy?.(entryPath);
|
|
30582
30673
|
if (reason4) {
|
|
30583
30674
|
result.skipped.push({ name: entry.name, reason: reason4 });
|
|
@@ -30597,7 +30688,7 @@ function pruneCommands(targetDir, commandNames, options2) {
|
|
|
30597
30688
|
targetDir,
|
|
30598
30689
|
commandNames,
|
|
30599
30690
|
{
|
|
30600
|
-
nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ?
|
|
30691
|
+
nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ? path68.basename(entry.name, ".md") : void 0
|
|
30601
30692
|
},
|
|
30602
30693
|
options2
|
|
30603
30694
|
);
|
|
@@ -30632,24 +30723,24 @@ function reportPrune(label2, result, force) {
|
|
|
30632
30723
|
|
|
30633
30724
|
// src/commands/sync/syncClaudeMd.ts
|
|
30634
30725
|
import * as fs41 from "fs";
|
|
30635
|
-
import * as
|
|
30636
|
-
import
|
|
30726
|
+
import * as path69 from "path";
|
|
30727
|
+
import chalk220 from "chalk";
|
|
30637
30728
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
30638
|
-
const source =
|
|
30639
|
-
const target =
|
|
30729
|
+
const source = path69.join(claudeDir, "CLAUDE.md");
|
|
30730
|
+
const target = path69.join(targetBase, "CLAUDE.md");
|
|
30640
30731
|
const sourceContent = fs41.readFileSync(source, "utf8");
|
|
30641
30732
|
if (fs41.existsSync(target)) {
|
|
30642
30733
|
const targetContent = fs41.readFileSync(target, "utf8");
|
|
30643
30734
|
if (sourceContent !== targetContent) {
|
|
30644
30735
|
console.log(
|
|
30645
|
-
|
|
30736
|
+
chalk220.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
30646
30737
|
);
|
|
30647
30738
|
console.log();
|
|
30648
30739
|
printDiff(targetContent, sourceContent);
|
|
30649
30740
|
if (!options2?.yes) {
|
|
30650
30741
|
printAutoConfirmHint();
|
|
30651
30742
|
const confirm = await promptConfirm(
|
|
30652
|
-
|
|
30743
|
+
chalk220.red("Overwrite existing CLAUDE.md?"),
|
|
30653
30744
|
false
|
|
30654
30745
|
);
|
|
30655
30746
|
if (!confirm) {
|
|
@@ -30664,13 +30755,13 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
30664
30755
|
}
|
|
30665
30756
|
|
|
30666
30757
|
// src/commands/sync/syncCodex.ts
|
|
30667
|
-
import * as
|
|
30758
|
+
import * as path72 from "path";
|
|
30668
30759
|
|
|
30669
30760
|
// src/commands/sync/installHarnessCommands.ts
|
|
30670
30761
|
import * as fs42 from "fs";
|
|
30671
|
-
import * as
|
|
30762
|
+
import * as path70 from "path";
|
|
30672
30763
|
function installHarnessCommands(claudeDir, harness, transform) {
|
|
30673
|
-
const commandsSource =
|
|
30764
|
+
const commandsSource = path70.join(claudeDir, "commands");
|
|
30674
30765
|
const files = fs42.readdirSync(commandsSource);
|
|
30675
30766
|
const names = [];
|
|
30676
30767
|
let synced = 0;
|
|
@@ -30678,15 +30769,15 @@ function installHarnessCommands(claudeDir, harness, transform) {
|
|
|
30678
30769
|
if (!file.endsWith(".md")) continue;
|
|
30679
30770
|
const name = file.replace(/\.md$/, "");
|
|
30680
30771
|
names.push(name);
|
|
30681
|
-
const content = fs42.readFileSync(
|
|
30682
|
-
const target =
|
|
30683
|
-
fs42.mkdirSync(
|
|
30772
|
+
const content = fs42.readFileSync(path70.join(commandsSource, file), "utf8");
|
|
30773
|
+
const target = path70.join(harness.homeDir, harness.sync.commandDest(name));
|
|
30774
|
+
fs42.mkdirSync(path70.dirname(target), { recursive: true });
|
|
30684
30775
|
fs42.writeFileSync(target, transform(name, content));
|
|
30685
30776
|
synced++;
|
|
30686
30777
|
}
|
|
30687
|
-
const agentsTarget =
|
|
30688
|
-
fs42.mkdirSync(
|
|
30689
|
-
fs42.copyFileSync(
|
|
30778
|
+
const agentsTarget = path70.join(harness.homeDir, harness.sync.agentsFile);
|
|
30779
|
+
fs42.mkdirSync(path70.dirname(agentsTarget), { recursive: true });
|
|
30780
|
+
fs42.copyFileSync(path70.join(claudeDir, "CLAUDE.md"), agentsTarget);
|
|
30690
30781
|
return { total: files.length, synced, names };
|
|
30691
30782
|
}
|
|
30692
30783
|
|
|
@@ -30712,7 +30803,7 @@ function unexpectedContent(skillDir) {
|
|
|
30712
30803
|
|
|
30713
30804
|
// src/commands/sync/syncCodexHooks.ts
|
|
30714
30805
|
import * as fs44 from "fs";
|
|
30715
|
-
import * as
|
|
30806
|
+
import * as path71 from "path";
|
|
30716
30807
|
var BEGIN = "# >>> assist codex hooks (managed) \u2014 do not edit >>>";
|
|
30717
30808
|
var END = "# <<< assist codex hooks (managed) <<<";
|
|
30718
30809
|
function upsertManagedBlock(existing, body) {
|
|
@@ -30743,9 +30834,9 @@ ${rest}
|
|
|
30743
30834
|
}
|
|
30744
30835
|
function syncCodexHooks(sourcePath) {
|
|
30745
30836
|
const body = fs44.readFileSync(sourcePath, "utf8");
|
|
30746
|
-
const configPath =
|
|
30837
|
+
const configPath = path71.join(harnesses.codex.homeDir, "config.toml");
|
|
30747
30838
|
const existing = fs44.existsSync(configPath) ? fs44.readFileSync(configPath, "utf8") : "";
|
|
30748
|
-
fs44.mkdirSync(
|
|
30839
|
+
fs44.mkdirSync(path71.dirname(configPath), { recursive: true });
|
|
30749
30840
|
fs44.writeFileSync(configPath, upsertManagedBlock(existing, body));
|
|
30750
30841
|
console.log(
|
|
30751
30842
|
"Registered assist codex-hook in ~/.codex/config.toml (UserPromptSubmit, PreToolUse, PostToolUse, PermissionRequest, Stop)"
|
|
@@ -30777,7 +30868,7 @@ function syncCodex(claudeDir, options2) {
|
|
|
30777
30868
|
harnesses.codex,
|
|
30778
30869
|
commandToSkill
|
|
30779
30870
|
);
|
|
30780
|
-
syncCodexHooks(
|
|
30871
|
+
syncCodexHooks(path72.join(claudeDir, "..", "codex", "config.toml"));
|
|
30781
30872
|
console.log(
|
|
30782
30873
|
`Synced ${total} skill(s) to ~/.codex/skills and CLAUDE.md to ~/.codex/AGENTS.md`
|
|
30783
30874
|
);
|
|
@@ -30785,42 +30876,42 @@ function syncCodex(claudeDir, options2) {
|
|
|
30785
30876
|
const force = options2.force ?? false;
|
|
30786
30877
|
reportPrune(
|
|
30787
30878
|
"~/.codex/skills",
|
|
30788
|
-
pruneSkills(
|
|
30879
|
+
pruneSkills(path72.join(harnesses.codex.homeDir, "skills"), names, { force }),
|
|
30789
30880
|
force
|
|
30790
30881
|
);
|
|
30791
30882
|
}
|
|
30792
30883
|
|
|
30793
30884
|
// src/commands/sync/syncDesign.ts
|
|
30794
30885
|
import * as fs45 from "fs";
|
|
30795
|
-
import * as
|
|
30886
|
+
import * as path73 from "path";
|
|
30796
30887
|
function syncDesign(claudeDir, targetBase) {
|
|
30797
|
-
const systemPromptSource =
|
|
30798
|
-
const systemPromptTarget =
|
|
30888
|
+
const systemPromptSource = path73.join(claudeDir, "design-system-prompt.md");
|
|
30889
|
+
const systemPromptTarget = path73.join(targetBase, "design-system-prompt.md");
|
|
30799
30890
|
fs45.copyFileSync(systemPromptSource, systemPromptTarget);
|
|
30800
30891
|
console.log(
|
|
30801
30892
|
"Copied design-system-prompt.md to ~/.claude/design-system-prompt.md"
|
|
30802
30893
|
);
|
|
30803
|
-
const skillsSource =
|
|
30804
|
-
const skillsTarget =
|
|
30894
|
+
const skillsSource = path73.join(claudeDir, "skills");
|
|
30895
|
+
const skillsTarget = path73.join(targetBase, "skills");
|
|
30805
30896
|
fs45.mkdirSync(skillsTarget, { recursive: true });
|
|
30806
30897
|
const files = fs45.readdirSync(skillsSource);
|
|
30807
30898
|
for (const file of files) {
|
|
30808
30899
|
fs45.copyFileSync(
|
|
30809
|
-
|
|
30810
|
-
|
|
30900
|
+
path73.join(skillsSource, file),
|
|
30901
|
+
path73.join(skillsTarget, file)
|
|
30811
30902
|
);
|
|
30812
30903
|
}
|
|
30813
30904
|
console.log(`Synced ${files.length} design skill(s) to ~/.claude/skills`);
|
|
30814
30905
|
}
|
|
30815
30906
|
|
|
30816
30907
|
// src/commands/sync/syncPi.ts
|
|
30817
|
-
import * as
|
|
30908
|
+
import * as path75 from "path";
|
|
30818
30909
|
|
|
30819
30910
|
// src/commands/sync/syncPiHooks.ts
|
|
30820
30911
|
import * as fs46 from "fs";
|
|
30821
|
-
import * as
|
|
30912
|
+
import * as path74 from "path";
|
|
30822
30913
|
function piExtensionsDir() {
|
|
30823
|
-
return
|
|
30914
|
+
return path74.join(harnesses.pi.homeDir, "extensions");
|
|
30824
30915
|
}
|
|
30825
30916
|
function syncPiHooks(sourceDir) {
|
|
30826
30917
|
const target = piExtensionsDir();
|
|
@@ -30828,8 +30919,8 @@ function syncPiHooks(sourceDir) {
|
|
|
30828
30919
|
const files = fs46.readdirSync(sourceDir).filter((f) => f.endsWith(".ts"));
|
|
30829
30920
|
for (const file of files) {
|
|
30830
30921
|
fs46.copyFileSync(
|
|
30831
|
-
|
|
30832
|
-
|
|
30922
|
+
path74.join(sourceDir, file),
|
|
30923
|
+
path74.join(target, `assist-${file}`)
|
|
30833
30924
|
);
|
|
30834
30925
|
}
|
|
30835
30926
|
console.log(
|
|
@@ -30866,7 +30957,7 @@ function syncPi(claudeDir, options2) {
|
|
|
30866
30957
|
harnesses.pi,
|
|
30867
30958
|
commandToPrompt
|
|
30868
30959
|
);
|
|
30869
|
-
syncPiHooks(
|
|
30960
|
+
syncPiHooks(path75.join(claudeDir, "..", "pi"));
|
|
30870
30961
|
console.log(
|
|
30871
30962
|
`Synced ${synced} prompt(s) to ~/.pi/agent/prompts and CLAUDE.md to ~/.pi/agent/AGENTS.md`
|
|
30872
30963
|
);
|
|
@@ -30874,18 +30965,18 @@ function syncPi(claudeDir, options2) {
|
|
|
30874
30965
|
const force = options2.force ?? false;
|
|
30875
30966
|
reportPrune(
|
|
30876
30967
|
"~/.pi/agent/prompts",
|
|
30877
|
-
pruneCommands(
|
|
30968
|
+
pruneCommands(path75.join(harnesses.pi.homeDir, "prompts"), names, { force }),
|
|
30878
30969
|
force
|
|
30879
30970
|
);
|
|
30880
30971
|
}
|
|
30881
30972
|
|
|
30882
30973
|
// src/commands/sync/syncSettings.ts
|
|
30883
30974
|
import * as fs47 from "fs";
|
|
30884
|
-
import * as
|
|
30885
|
-
import
|
|
30975
|
+
import * as path76 from "path";
|
|
30976
|
+
import chalk221 from "chalk";
|
|
30886
30977
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
30887
|
-
const source =
|
|
30888
|
-
const target =
|
|
30978
|
+
const source = path76.join(claudeDir, "settings.json");
|
|
30979
|
+
const target = path76.join(targetBase, "settings.json");
|
|
30889
30980
|
const sourceContent = fs47.readFileSync(source, "utf8");
|
|
30890
30981
|
const sourceSettings = JSON.parse(sourceContent);
|
|
30891
30982
|
const targetExists = fs47.existsSync(target);
|
|
@@ -30901,7 +30992,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
30901
30992
|
if (mergedContent !== normalizedTarget) {
|
|
30902
30993
|
if (!options2?.yes) {
|
|
30903
30994
|
console.log(
|
|
30904
|
-
|
|
30995
|
+
chalk221.yellow(
|
|
30905
30996
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
30906
30997
|
)
|
|
30907
30998
|
);
|
|
@@ -30909,7 +31000,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
30909
31000
|
printDiff(targetContent, mergedContent);
|
|
30910
31001
|
printAutoConfirmHint();
|
|
30911
31002
|
const confirm = await promptConfirm(
|
|
30912
|
-
|
|
31003
|
+
chalk221.red("Overwrite existing settings.json?"),
|
|
30913
31004
|
false
|
|
30914
31005
|
);
|
|
30915
31006
|
if (!confirm) {
|
|
@@ -30925,13 +31016,13 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
30925
31016
|
|
|
30926
31017
|
// src/commands/sync.ts
|
|
30927
31018
|
var __filename4 = fileURLToPath8(import.meta.url);
|
|
30928
|
-
var __dirname5 =
|
|
31019
|
+
var __dirname5 = path77.dirname(__filename4);
|
|
30929
31020
|
async function sync(options2) {
|
|
30930
31021
|
const config = loadConfig();
|
|
30931
31022
|
const yes = options2?.yes ?? config.sync.autoConfirm;
|
|
30932
31023
|
const prune = { prune: options2?.prune, force: options2?.force };
|
|
30933
|
-
const claudeDir =
|
|
30934
|
-
const targetBase =
|
|
31024
|
+
const claudeDir = path77.join(__dirname5, "..", "claude");
|
|
31025
|
+
const targetBase = path77.join(os5.homedir(), ".claude");
|
|
30935
31026
|
const commandFiles = syncCommands(claudeDir, targetBase);
|
|
30936
31027
|
syncDesign(claudeDir, targetBase);
|
|
30937
31028
|
await syncSettings(claudeDir, targetBase, { yes });
|
|
@@ -30939,21 +31030,21 @@ async function sync(options2) {
|
|
|
30939
31030
|
syncCodex(claudeDir, prune);
|
|
30940
31031
|
syncPi(claudeDir, prune);
|
|
30941
31032
|
if (!options2?.prune) return;
|
|
30942
|
-
const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) =>
|
|
31033
|
+
const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) => path77.basename(file, ".md"));
|
|
30943
31034
|
const force = options2.force ?? false;
|
|
30944
31035
|
reportPrune(
|
|
30945
31036
|
"~/.claude/commands",
|
|
30946
|
-
pruneCommands(
|
|
31037
|
+
pruneCommands(path77.join(targetBase, "commands"), commandNames, { force }),
|
|
30947
31038
|
force
|
|
30948
31039
|
);
|
|
30949
31040
|
}
|
|
30950
31041
|
function syncCommands(claudeDir, targetBase) {
|
|
30951
|
-
const sourceDir =
|
|
30952
|
-
const targetDir =
|
|
31042
|
+
const sourceDir = path77.join(claudeDir, "commands");
|
|
31043
|
+
const targetDir = path77.join(targetBase, "commands");
|
|
30953
31044
|
fs48.mkdirSync(targetDir, { recursive: true });
|
|
30954
31045
|
const files = fs48.readdirSync(sourceDir);
|
|
30955
31046
|
for (const file of files) {
|
|
30956
|
-
fs48.copyFileSync(
|
|
31047
|
+
fs48.copyFileSync(path77.join(sourceDir, file), path77.join(targetDir, file));
|
|
30957
31048
|
console.log(`Copied ${file} to ${targetDir}`);
|
|
30958
31049
|
}
|
|
30959
31050
|
console.log(`Synced ${files.length} command(s) to ~/.claude/commands`);
|
|
@@ -30981,10 +31072,7 @@ function registerSync(program2) {
|
|
|
30981
31072
|
}
|
|
30982
31073
|
|
|
30983
31074
|
// src/commands/transcript/clean.ts
|
|
30984
|
-
import { existsSync as
|
|
30985
|
-
|
|
30986
|
-
// src/commands/transcript/convertVttToMarkdown.ts
|
|
30987
|
-
import { readFileSync as readFileSync50 } from "fs";
|
|
31075
|
+
import { existsSync as existsSync66 } from "fs";
|
|
30988
31076
|
|
|
30989
31077
|
// src/commands/transcript/cleanText.ts
|
|
30990
31078
|
function cleanText(text18) {
|
|
@@ -31189,25 +31277,59 @@ function formatChatLog(messages) {
|
|
|
31189
31277
|
return messages.map((msg) => `${msg.speaker}: ${msg.text}`).join("\n\n");
|
|
31190
31278
|
}
|
|
31191
31279
|
|
|
31192
|
-
// src/commands/transcript/
|
|
31193
|
-
function
|
|
31194
|
-
|
|
31195
|
-
|
|
31196
|
-
|
|
31280
|
+
// src/commands/transcript/convert/formatVtt.ts
|
|
31281
|
+
function pad(value, width) {
|
|
31282
|
+
return String(value).padStart(width, "0");
|
|
31283
|
+
}
|
|
31284
|
+
function formatTimestamp2(ms) {
|
|
31285
|
+
const totalSeconds = Math.floor(ms / 1e3);
|
|
31286
|
+
const hours = Math.floor(totalSeconds / 3600);
|
|
31287
|
+
const minutes = Math.floor(totalSeconds % 3600 / 60);
|
|
31288
|
+
const seconds = totalSeconds % 60;
|
|
31289
|
+
return `${pad(hours, 2)}:${pad(minutes, 2)}:${pad(seconds, 2)}.${pad(ms % 1e3, 3)}`;
|
|
31290
|
+
}
|
|
31291
|
+
function formatCue(cue) {
|
|
31292
|
+
const timing = `${formatTimestamp2(cue.startMs)} --> ${formatTimestamp2(cue.endMs)}`;
|
|
31293
|
+
const text18 = cue.speaker ? `<v ${cue.speaker}>${cue.text}` : cue.text;
|
|
31294
|
+
return `${timing}
|
|
31295
|
+
${text18}`;
|
|
31296
|
+
}
|
|
31297
|
+
function formatVtt(cues) {
|
|
31298
|
+
return ["WEBVTT", ...cues.map(formatCue)].join("\n\n");
|
|
31299
|
+
}
|
|
31300
|
+
|
|
31301
|
+
// src/commands/transcript/convert/readCleanedCues.ts
|
|
31302
|
+
import { readFileSync as readFileSync51 } from "fs";
|
|
31303
|
+
function readCleanedCues(inputPath) {
|
|
31304
|
+
return deduplicateCues(parseVtt(readFileSync51(inputPath, "utf8")));
|
|
31197
31305
|
}
|
|
31198
31306
|
|
|
31199
31307
|
// src/commands/transcript/clean.ts
|
|
31200
|
-
|
|
31201
|
-
|
|
31308
|
+
var FORMATS = ["md", "vtt"];
|
|
31309
|
+
function isCleanFormat(value) {
|
|
31310
|
+
return FORMATS.includes(value);
|
|
31311
|
+
}
|
|
31312
|
+
function serialise(cues, format) {
|
|
31313
|
+
return format === "vtt" ? formatVtt(cues) : formatChatLog(cuesToChatMessages(cues));
|
|
31314
|
+
}
|
|
31315
|
+
function clean(file, options2 = {}) {
|
|
31316
|
+
const format = options2.format ?? "md";
|
|
31317
|
+
if (!isCleanFormat(format)) {
|
|
31318
|
+
console.error(
|
|
31319
|
+
`Error: --format must be one of: ${FORMATS.join(", ")} (got: ${format})`
|
|
31320
|
+
);
|
|
31321
|
+
process.exit(1);
|
|
31322
|
+
}
|
|
31323
|
+
if (!existsSync66(file)) {
|
|
31202
31324
|
console.error(`Error: VTT file not found: ${file}`);
|
|
31203
31325
|
process.exit(1);
|
|
31204
31326
|
}
|
|
31205
|
-
const
|
|
31206
|
-
if (
|
|
31327
|
+
const cues = readCleanedCues(file);
|
|
31328
|
+
if (cues.length === 0) {
|
|
31207
31329
|
console.error(`Error: no cues found in: ${file}`);
|
|
31208
31330
|
process.exit(1);
|
|
31209
31331
|
}
|
|
31210
|
-
console.log(
|
|
31332
|
+
console.log(serialise(cues, format));
|
|
31211
31333
|
}
|
|
31212
31334
|
|
|
31213
31335
|
// src/commands/transcript/shared.ts
|
|
@@ -31281,21 +31403,28 @@ async function configure() {
|
|
|
31281
31403
|
}
|
|
31282
31404
|
|
|
31283
31405
|
// src/commands/transcript/list.ts
|
|
31284
|
-
import { existsSync as
|
|
31406
|
+
import { existsSync as existsSync67, readdirSync as readdirSync19, statSync as statSync11 } from "fs";
|
|
31285
31407
|
import { join as join78 } from "path";
|
|
31286
31408
|
function list4() {
|
|
31287
31409
|
const { vttDir } = getTranscriptConfig();
|
|
31288
|
-
if (!
|
|
31410
|
+
if (!existsSync67(vttDir)) return;
|
|
31289
31411
|
for (const entry of readdirSync19(vttDir)) {
|
|
31290
31412
|
if (!entry.endsWith(".vtt")) continue;
|
|
31291
|
-
if (
|
|
31413
|
+
if (statSync11(join78(vttDir, entry)).isDirectory()) continue;
|
|
31292
31414
|
console.log(entry);
|
|
31293
31415
|
}
|
|
31294
31416
|
}
|
|
31295
31417
|
|
|
31296
31418
|
// src/commands/transcript/move.ts
|
|
31297
|
-
import { existsSync as
|
|
31419
|
+
import { existsSync as existsSync68, mkdirSync as mkdirSync27, renameSync as renameSync2, writeFileSync as writeFileSync43 } from "fs";
|
|
31298
31420
|
import { basename as basename21, join as join79 } from "path";
|
|
31421
|
+
|
|
31422
|
+
// src/commands/transcript/convertVttToMarkdown.ts
|
|
31423
|
+
function convertVttToMarkdown(inputPath) {
|
|
31424
|
+
return formatChatLog(cuesToChatMessages(readCleanedCues(inputPath)));
|
|
31425
|
+
}
|
|
31426
|
+
|
|
31427
|
+
// src/commands/transcript/move.ts
|
|
31299
31428
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
31300
31429
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
31301
31430
|
const processedDir = join79(vttDir, "processed");
|
|
@@ -31311,7 +31440,7 @@ function move(file, options2) {
|
|
|
31311
31440
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
31312
31441
|
const filename = basename21(file);
|
|
31313
31442
|
const sourcePath = join79(vttDir, filename);
|
|
31314
|
-
if (!
|
|
31443
|
+
if (!existsSync68(sourcePath)) {
|
|
31315
31444
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
31316
31445
|
process.exit(1);
|
|
31317
31446
|
}
|
|
@@ -31333,7 +31462,7 @@ function registerTranscript(program2) {
|
|
|
31333
31462
|
configHelp(transcriptCommand, transcriptConfigHelp);
|
|
31334
31463
|
transcriptCommand.command("configure").description("Configure transcript directories").action(configure);
|
|
31335
31464
|
transcriptCommand.command("list").description("List raw .vtt filenames waiting in the pick-up directory").action(list4);
|
|
31336
|
-
transcriptCommand.command("clean <path>").description("Clean any .vtt file and write the
|
|
31465
|
+
transcriptCommand.command("clean <path>").description("Clean any .vtt file and write the result to stdout").option("--format <md|vtt>", "output format", "md").action(clean);
|
|
31337
31466
|
transcriptCommand.command("move <file>").description(
|
|
31338
31467
|
"Convert a raw .vtt to a dated markdown transcript and archive the original"
|
|
31339
31468
|
).requiredOption("--date <YYYY-MM-DD>", "meeting date").requiredOption("--client <name>", "client name").action(move);
|
|
@@ -31441,14 +31570,14 @@ function devices() {
|
|
|
31441
31570
|
}
|
|
31442
31571
|
|
|
31443
31572
|
// src/commands/voice/logs.ts
|
|
31444
|
-
import { existsSync as
|
|
31573
|
+
import { existsSync as existsSync69, readFileSync as readFileSync52 } from "fs";
|
|
31445
31574
|
function logs(options2) {
|
|
31446
|
-
if (!
|
|
31575
|
+
if (!existsSync69(voicePaths.log)) {
|
|
31447
31576
|
console.log("No voice log file found");
|
|
31448
31577
|
return;
|
|
31449
31578
|
}
|
|
31450
31579
|
const count8 = Number.parseInt(options2.lines ?? "150", 10);
|
|
31451
|
-
const content =
|
|
31580
|
+
const content = readFileSync52(voicePaths.log, "utf8").trim();
|
|
31452
31581
|
if (!content) {
|
|
31453
31582
|
console.log("Voice log is empty");
|
|
31454
31583
|
return;
|
|
@@ -31475,7 +31604,7 @@ import { join as join83 } from "path";
|
|
|
31475
31604
|
|
|
31476
31605
|
// src/commands/voice/checkLockFile.ts
|
|
31477
31606
|
import { execSync as execSync58 } from "child_process";
|
|
31478
|
-
import { existsSync as
|
|
31607
|
+
import { existsSync as existsSync70, mkdirSync as mkdirSync28, readFileSync as readFileSync53, writeFileSync as writeFileSync44 } from "fs";
|
|
31479
31608
|
import { join as join82 } from "path";
|
|
31480
31609
|
function isProcessAlive2(pid) {
|
|
31481
31610
|
try {
|
|
@@ -31487,9 +31616,9 @@ function isProcessAlive2(pid) {
|
|
|
31487
31616
|
}
|
|
31488
31617
|
function checkLockFile() {
|
|
31489
31618
|
const lockFile = getLockFile();
|
|
31490
|
-
if (!
|
|
31619
|
+
if (!existsSync70(lockFile)) return;
|
|
31491
31620
|
try {
|
|
31492
|
-
const lock2 = JSON.parse(
|
|
31621
|
+
const lock2 = JSON.parse(readFileSync53(lockFile, "utf8"));
|
|
31493
31622
|
if (lock2.pid && isProcessAlive2(lock2.pid)) {
|
|
31494
31623
|
console.error(
|
|
31495
31624
|
`Voice daemon already running (PID ${lock2.pid}, env: ${lock2.env}). Stop it first with: assist voice stop`
|
|
@@ -31500,7 +31629,7 @@ function checkLockFile() {
|
|
|
31500
31629
|
}
|
|
31501
31630
|
}
|
|
31502
31631
|
function bootstrapVenv() {
|
|
31503
|
-
if (
|
|
31632
|
+
if (existsSync70(getVenvPython())) return;
|
|
31504
31633
|
console.log("Setting up Python environment...");
|
|
31505
31634
|
const pythonDir = getPythonDir();
|
|
31506
31635
|
execSync58(
|
|
@@ -31591,7 +31720,7 @@ function start2(options2) {
|
|
|
31591
31720
|
}
|
|
31592
31721
|
|
|
31593
31722
|
// src/commands/voice/status.ts
|
|
31594
|
-
import { existsSync as
|
|
31723
|
+
import { existsSync as existsSync71, readFileSync as readFileSync54 } from "fs";
|
|
31595
31724
|
function isProcessAlive3(pid) {
|
|
31596
31725
|
try {
|
|
31597
31726
|
process.kill(pid, 0);
|
|
@@ -31601,16 +31730,16 @@ function isProcessAlive3(pid) {
|
|
|
31601
31730
|
}
|
|
31602
31731
|
}
|
|
31603
31732
|
function readRecentLogs(count8) {
|
|
31604
|
-
if (!
|
|
31605
|
-
const lines2 =
|
|
31733
|
+
if (!existsSync71(voicePaths.log)) return [];
|
|
31734
|
+
const lines2 = readFileSync54(voicePaths.log, "utf8").trim().split("\n");
|
|
31606
31735
|
return lines2.slice(-count8);
|
|
31607
31736
|
}
|
|
31608
31737
|
function status2() {
|
|
31609
|
-
if (!
|
|
31738
|
+
if (!existsSync71(voicePaths.pid)) {
|
|
31610
31739
|
console.log("Voice daemon: not running (no PID file)");
|
|
31611
31740
|
return;
|
|
31612
31741
|
}
|
|
31613
|
-
const pid = Number.parseInt(
|
|
31742
|
+
const pid = Number.parseInt(readFileSync54(voicePaths.pid, "utf8").trim(), 10);
|
|
31614
31743
|
const alive = isProcessAlive3(pid);
|
|
31615
31744
|
console.log(`Voice daemon: ${alive ? "running" : "dead"} (PID ${pid})`);
|
|
31616
31745
|
const recent = readRecentLogs(5);
|
|
@@ -31629,13 +31758,13 @@ function status2() {
|
|
|
31629
31758
|
}
|
|
31630
31759
|
|
|
31631
31760
|
// src/commands/voice/stop.ts
|
|
31632
|
-
import { existsSync as
|
|
31761
|
+
import { existsSync as existsSync72, readFileSync as readFileSync55, unlinkSync as unlinkSync20 } from "fs";
|
|
31633
31762
|
function stop2() {
|
|
31634
|
-
if (!
|
|
31763
|
+
if (!existsSync72(voicePaths.pid)) {
|
|
31635
31764
|
console.log("Voice daemon is not running (no PID file)");
|
|
31636
31765
|
return;
|
|
31637
31766
|
}
|
|
31638
|
-
const pid = Number.parseInt(
|
|
31767
|
+
const pid = Number.parseInt(readFileSync55(voicePaths.pid, "utf8").trim(), 10);
|
|
31639
31768
|
try {
|
|
31640
31769
|
process.kill(pid, "SIGTERM");
|
|
31641
31770
|
console.log(`Sent SIGTERM to voice daemon (PID ${pid})`);
|
|
@@ -31648,7 +31777,7 @@ function stop2() {
|
|
|
31648
31777
|
}
|
|
31649
31778
|
try {
|
|
31650
31779
|
const lockFile = getLockFile();
|
|
31651
|
-
if (
|
|
31780
|
+
if (existsSync72(lockFile)) unlinkSync20(lockFile);
|
|
31652
31781
|
} catch {
|
|
31653
31782
|
}
|
|
31654
31783
|
console.log("Voice daemon stopped");
|
|
@@ -31773,11 +31902,11 @@ var webUiPrefix = "src/commands/sessions/web/ui/";
|
|
|
31773
31902
|
var sessionsPrefix = "src/commands/sessions/";
|
|
31774
31903
|
var rules = [
|
|
31775
31904
|
{
|
|
31776
|
-
matches: (
|
|
31905
|
+
matches: (path83) => path83.startsWith(webUiPrefix),
|
|
31777
31906
|
advice: "restart the web server, then hard-reload the browser tab"
|
|
31778
31907
|
},
|
|
31779
31908
|
{
|
|
31780
|
-
matches: (
|
|
31909
|
+
matches: (path83) => path83.startsWith(sessionsPrefix) && !path83.startsWith(webUiPrefix),
|
|
31781
31910
|
advice: "restart the daemon"
|
|
31782
31911
|
}
|
|
31783
31912
|
];
|
|
@@ -31788,31 +31917,31 @@ function restartAdvice(paths) {
|
|
|
31788
31917
|
// src/commands/watch/syncAdvice.ts
|
|
31789
31918
|
var rules2 = [
|
|
31790
31919
|
{
|
|
31791
|
-
matches: (
|
|
31920
|
+
matches: (path83) => path83.startsWith("claude/commands/"),
|
|
31792
31921
|
reason: "claude/commands changed"
|
|
31793
31922
|
},
|
|
31794
31923
|
{
|
|
31795
|
-
matches: (
|
|
31924
|
+
matches: (path83) => path83.startsWith("claude/skills/"),
|
|
31796
31925
|
reason: "claude/skills changed"
|
|
31797
31926
|
},
|
|
31798
31927
|
{
|
|
31799
|
-
matches: (
|
|
31928
|
+
matches: (path83) => path83 === "claude/settings.json",
|
|
31800
31929
|
reason: "claude/settings.json changed"
|
|
31801
31930
|
},
|
|
31802
31931
|
{
|
|
31803
|
-
matches: (
|
|
31932
|
+
matches: (path83) => path83 === "claude/CLAUDE.md",
|
|
31804
31933
|
reason: "claude/CLAUDE.md changed"
|
|
31805
31934
|
},
|
|
31806
31935
|
{
|
|
31807
|
-
matches: (
|
|
31936
|
+
matches: (path83) => path83 === "claude/design-system-prompt.md",
|
|
31808
31937
|
reason: "claude/design-system-prompt.md changed"
|
|
31809
31938
|
},
|
|
31810
31939
|
{
|
|
31811
|
-
matches: (
|
|
31940
|
+
matches: (path83) => path83.startsWith("codex/"),
|
|
31812
31941
|
reason: "codex sources changed"
|
|
31813
31942
|
},
|
|
31814
31943
|
{
|
|
31815
|
-
matches: (
|
|
31944
|
+
matches: (path83) => path83.startsWith("pi/"),
|
|
31816
31945
|
reason: "pi sources changed"
|
|
31817
31946
|
}
|
|
31818
31947
|
];
|
|
@@ -32053,7 +32182,7 @@ function resolveParams(params, cliArgs) {
|
|
|
32053
32182
|
}
|
|
32054
32183
|
|
|
32055
32184
|
// src/commands/run/resolveRunCwd.ts
|
|
32056
|
-
import { existsSync as
|
|
32185
|
+
import { existsSync as existsSync73 } from "fs";
|
|
32057
32186
|
import { resolve as resolve19 } from "path";
|
|
32058
32187
|
var MissingRunCwdError = class extends Error {
|
|
32059
32188
|
constructor(runName, cwd) {
|
|
@@ -32066,17 +32195,17 @@ var MissingRunCwdError = class extends Error {
|
|
|
32066
32195
|
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
32067
32196
|
if (!config.cwd) return void 0;
|
|
32068
32197
|
const cwd = resolve19(baseDir, config.cwd);
|
|
32069
|
-
if (!
|
|
32198
|
+
if (!existsSync73(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
32070
32199
|
return cwd;
|
|
32071
32200
|
}
|
|
32072
32201
|
|
|
32073
32202
|
// src/commands/run/runCommandToCompletion.ts
|
|
32074
32203
|
import { spawn as spawn9 } from "child_process";
|
|
32075
|
-
import { existsSync as
|
|
32204
|
+
import { existsSync as existsSync75 } from "fs";
|
|
32076
32205
|
|
|
32077
32206
|
// src/commands/run/resolveCommand.ts
|
|
32078
32207
|
import { execFileSync as execFileSync16 } from "child_process";
|
|
32079
|
-
import { existsSync as
|
|
32208
|
+
import { existsSync as existsSync74 } from "fs";
|
|
32080
32209
|
import { dirname as dirname37, join as join86, resolve as resolve20 } from "path";
|
|
32081
32210
|
function resolveCommand2(command) {
|
|
32082
32211
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
@@ -32084,7 +32213,7 @@ function resolveCommand2(command) {
|
|
|
32084
32213
|
const gitPath = execFileSync16("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
32085
32214
|
const gitRoot = resolve20(dirname37(gitPath), "..");
|
|
32086
32215
|
const gitBash = join86(gitRoot, "bin", "bash.exe");
|
|
32087
|
-
if (
|
|
32216
|
+
if (existsSync74(gitBash)) return gitBash;
|
|
32088
32217
|
} catch {
|
|
32089
32218
|
return command;
|
|
32090
32219
|
}
|
|
@@ -32094,7 +32223,7 @@ function resolveCommand2(command) {
|
|
|
32094
32223
|
// src/commands/run/runCommandToCompletion.ts
|
|
32095
32224
|
function runCommandToCompletion(command, args, env, cwd, quiet) {
|
|
32096
32225
|
return new Promise((resolveResult) => {
|
|
32097
|
-
if (cwd && !
|
|
32226
|
+
if (cwd && !existsSync75(cwd)) {
|
|
32098
32227
|
resolveResult({
|
|
32099
32228
|
kind: "failed",
|
|
32100
32229
|
message: `Failed to execute command: cwd ${cwd} does not exist`
|
|
@@ -32351,7 +32480,7 @@ function registerWatch(program2) {
|
|
|
32351
32480
|
|
|
32352
32481
|
// src/commands/roam/auth.ts
|
|
32353
32482
|
import { randomBytes } from "crypto";
|
|
32354
|
-
import
|
|
32483
|
+
import chalk222 from "chalk";
|
|
32355
32484
|
|
|
32356
32485
|
// src/commands/roam/waitForCallback.ts
|
|
32357
32486
|
import { createServer as createServer3 } from "http";
|
|
@@ -32482,13 +32611,13 @@ async function auth() {
|
|
|
32482
32611
|
saveGlobalConfig(config);
|
|
32483
32612
|
const state = randomBytes(16).toString("hex");
|
|
32484
32613
|
console.log(
|
|
32485
|
-
|
|
32614
|
+
chalk222.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
32486
32615
|
);
|
|
32487
|
-
console.log(
|
|
32488
|
-
console.log(
|
|
32489
|
-
console.log(
|
|
32616
|
+
console.log(chalk222.white("http://localhost:14523/callback\n"));
|
|
32617
|
+
console.log(chalk222.blue("Opening browser for authorization..."));
|
|
32618
|
+
console.log(chalk222.dim("Waiting for authorization callback..."));
|
|
32490
32619
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
32491
|
-
console.log(
|
|
32620
|
+
console.log(chalk222.dim("Exchanging code for tokens..."));
|
|
32492
32621
|
const tokens = await exchangeToken({
|
|
32493
32622
|
code,
|
|
32494
32623
|
clientId,
|
|
@@ -32504,13 +32633,13 @@ async function auth() {
|
|
|
32504
32633
|
};
|
|
32505
32634
|
saveGlobalConfig(config);
|
|
32506
32635
|
console.log(
|
|
32507
|
-
|
|
32636
|
+
chalk222.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
32508
32637
|
);
|
|
32509
32638
|
}
|
|
32510
32639
|
|
|
32511
32640
|
// src/commands/roam/postRoamActivity.ts
|
|
32512
32641
|
import { execFileSync as execFileSync18 } from "child_process";
|
|
32513
|
-
import { readdirSync as readdirSync20, readFileSync as
|
|
32642
|
+
import { readdirSync as readdirSync20, readFileSync as readFileSync56, statSync as statSync12 } from "fs";
|
|
32514
32643
|
import { join as join87 } from "path";
|
|
32515
32644
|
function findPortFile(roamDir) {
|
|
32516
32645
|
let entries;
|
|
@@ -32520,9 +32649,9 @@ function findPortFile(roamDir) {
|
|
|
32520
32649
|
return void 0;
|
|
32521
32650
|
}
|
|
32522
32651
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
32523
|
-
const
|
|
32652
|
+
const path83 = join87(roamDir, name);
|
|
32524
32653
|
try {
|
|
32525
|
-
return { path:
|
|
32654
|
+
return { path: path83, mtimeMs: statSync12(path83).mtimeMs };
|
|
32526
32655
|
} catch {
|
|
32527
32656
|
return void 0;
|
|
32528
32657
|
}
|
|
@@ -32536,7 +32665,7 @@ function postRoamActivity(app, event) {
|
|
|
32536
32665
|
if (!portFile) return;
|
|
32537
32666
|
let port;
|
|
32538
32667
|
try {
|
|
32539
|
-
port =
|
|
32668
|
+
port = readFileSync56(portFile, "utf8").trim();
|
|
32540
32669
|
} catch {
|
|
32541
32670
|
return;
|
|
32542
32671
|
}
|
|
@@ -32758,11 +32887,11 @@ function findLinkIndex() {
|
|
|
32758
32887
|
function parseLinkArgs() {
|
|
32759
32888
|
const idx = findLinkIndex();
|
|
32760
32889
|
if (idx === -1) return null;
|
|
32761
|
-
const
|
|
32890
|
+
const path83 = process.argv[idx + 1];
|
|
32762
32891
|
const rest = process.argv.slice(idx + 2);
|
|
32763
32892
|
const { value: prefix2 } = extractOption(rest, "--prefix");
|
|
32764
32893
|
if (!prefix2) return null;
|
|
32765
|
-
return { path:
|
|
32894
|
+
return { path: path83, prefix: prefix2 };
|
|
32766
32895
|
}
|
|
32767
32896
|
function hasDuplicateLink(runList, linkPath) {
|
|
32768
32897
|
return runList.some(
|
|
@@ -32790,7 +32919,7 @@ function link2() {
|
|
|
32790
32919
|
}
|
|
32791
32920
|
|
|
32792
32921
|
// src/commands/run/remove.ts
|
|
32793
|
-
import { existsSync as
|
|
32922
|
+
import { existsSync as existsSync76, unlinkSync as unlinkSync21 } from "fs";
|
|
32794
32923
|
import { join as join89 } from "path";
|
|
32795
32924
|
function findRemoveIndex() {
|
|
32796
32925
|
const idx = process.argv.indexOf("remove");
|
|
@@ -32807,7 +32936,7 @@ function parseRemoveName() {
|
|
|
32807
32936
|
}
|
|
32808
32937
|
function deleteCommandFile(name) {
|
|
32809
32938
|
const filePath = join89(".claude", "commands", `${name}.md`);
|
|
32810
|
-
if (
|
|
32939
|
+
if (existsSync76(filePath)) {
|
|
32811
32940
|
unlinkSync21(filePath);
|
|
32812
32941
|
console.log(`Deleted command file: ${filePath}`);
|
|
32813
32942
|
}
|
|
@@ -32852,10 +32981,10 @@ function registerRun(program2) {
|
|
|
32852
32981
|
|
|
32853
32982
|
// src/commands/screenshot/index.ts
|
|
32854
32983
|
import { execSync as execSync60 } from "child_process";
|
|
32855
|
-
import { existsSync as
|
|
32984
|
+
import { existsSync as existsSync77, mkdirSync as mkdirSync32, unlinkSync as unlinkSync22, writeFileSync as writeFileSync47 } from "fs";
|
|
32856
32985
|
import { tmpdir as tmpdir8 } from "os";
|
|
32857
32986
|
import { join as join90, resolve as resolve21 } from "path";
|
|
32858
|
-
import
|
|
32987
|
+
import chalk223 from "chalk";
|
|
32859
32988
|
|
|
32860
32989
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
32861
32990
|
var captureWindowPs1 = `
|
|
@@ -32984,7 +33113,7 @@ Write-Output $OutputPath
|
|
|
32984
33113
|
|
|
32985
33114
|
// src/commands/screenshot/index.ts
|
|
32986
33115
|
function buildOutputPath(outputDir, processName) {
|
|
32987
|
-
if (!
|
|
33116
|
+
if (!existsSync77(outputDir)) {
|
|
32988
33117
|
mkdirSync32(outputDir, { recursive: true });
|
|
32989
33118
|
}
|
|
32990
33119
|
const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
@@ -33006,13 +33135,13 @@ function screenshot(processName) {
|
|
|
33006
33135
|
const config = loadConfig();
|
|
33007
33136
|
const outputDir = resolve21(config.screenshot.outputDir);
|
|
33008
33137
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
33009
|
-
console.log(
|
|
33138
|
+
console.log(chalk223.gray(`Capturing window for process "${processName}" ...`));
|
|
33010
33139
|
try {
|
|
33011
33140
|
runPowerShellScript(processName, outputPath);
|
|
33012
|
-
console.log(
|
|
33141
|
+
console.log(chalk223.green(`Screenshot saved: ${outputPath}`));
|
|
33013
33142
|
} catch (error) {
|
|
33014
33143
|
const msg = error instanceof Error ? error.message : String(error);
|
|
33015
|
-
console.error(
|
|
33144
|
+
console.error(chalk223.red(`Failed to capture screenshot: ${msg}`));
|
|
33016
33145
|
process.exit(1);
|
|
33017
33146
|
}
|
|
33018
33147
|
}
|
|
@@ -33068,11 +33197,11 @@ function applyLine(result, pending, line) {
|
|
|
33068
33197
|
}
|
|
33069
33198
|
|
|
33070
33199
|
// src/commands/sessions/daemon/readDaemonPidFile.ts
|
|
33071
|
-
import { readFileSync as
|
|
33200
|
+
import { readFileSync as readFileSync57 } from "fs";
|
|
33072
33201
|
function readDaemonPidFile() {
|
|
33073
33202
|
try {
|
|
33074
33203
|
const pid = Number.parseInt(
|
|
33075
|
-
|
|
33204
|
+
readFileSync57(daemonPaths.pid, "utf8").trim(),
|
|
33076
33205
|
10
|
|
33077
33206
|
);
|
|
33078
33207
|
return Number.isInteger(pid) ? pid : void 0;
|
|
@@ -33329,12 +33458,12 @@ function toSessionRunInfo({
|
|
|
33329
33458
|
}
|
|
33330
33459
|
|
|
33331
33460
|
// src/commands/sessions/daemon/worktree/joinRefusal.ts
|
|
33332
|
-
import { existsSync as
|
|
33461
|
+
import { existsSync as existsSync78 } from "fs";
|
|
33333
33462
|
function joinRefusal(session) {
|
|
33334
33463
|
if (session.commandType === "run") return "a server run has no agent stream";
|
|
33335
33464
|
if (session.closing === true) return "the session is closing";
|
|
33336
33465
|
if (!session.cwd) return "the session has no working directory";
|
|
33337
|
-
if (!
|
|
33466
|
+
if (!existsSync78(session.cwd))
|
|
33338
33467
|
return "the session's workspace no longer exists";
|
|
33339
33468
|
return void 0;
|
|
33340
33469
|
}
|
|
@@ -33498,27 +33627,27 @@ function sessionBase(id, status3) {
|
|
|
33498
33627
|
}
|
|
33499
33628
|
|
|
33500
33629
|
// src/commands/sessions/daemon/spawnPty.ts
|
|
33501
|
-
import { existsSync as
|
|
33630
|
+
import { existsSync as existsSync80 } from "fs";
|
|
33502
33631
|
import * as pty from "node-pty";
|
|
33503
33632
|
|
|
33504
33633
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
33505
|
-
import { chmodSync, existsSync as
|
|
33634
|
+
import { chmodSync, existsSync as existsSync79, statSync as statSync13 } from "fs";
|
|
33506
33635
|
import { createRequire as createRequire3 } from "module";
|
|
33507
|
-
import
|
|
33636
|
+
import path78 from "path";
|
|
33508
33637
|
var require4 = createRequire3(import.meta.url);
|
|
33509
33638
|
var ensured = false;
|
|
33510
33639
|
function ensureSpawnHelperExecutable() {
|
|
33511
33640
|
if (ensured || process.platform !== "darwin") return;
|
|
33512
33641
|
ensured = true;
|
|
33513
|
-
const ptyRoot =
|
|
33514
|
-
const helper =
|
|
33642
|
+
const ptyRoot = path78.join(path78.dirname(require4.resolve("node-pty")), "..");
|
|
33643
|
+
const helper = path78.join(
|
|
33515
33644
|
ptyRoot,
|
|
33516
33645
|
"prebuilds",
|
|
33517
33646
|
`${process.platform}-${process.arch}`,
|
|
33518
33647
|
"spawn-helper"
|
|
33519
33648
|
);
|
|
33520
|
-
if (!
|
|
33521
|
-
const mode =
|
|
33649
|
+
if (!existsSync79(helper)) return;
|
|
33650
|
+
const mode = statSync13(helper).mode;
|
|
33522
33651
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
33523
33652
|
}
|
|
33524
33653
|
|
|
@@ -33553,7 +33682,7 @@ function spawnPty(args, cwd, sessionId, extraEnv) {
|
|
|
33553
33682
|
});
|
|
33554
33683
|
}
|
|
33555
33684
|
function refuseMissingCwd(cwd, sessionId) {
|
|
33556
|
-
if (!cwd ||
|
|
33685
|
+
if (!cwd || existsSync80(cwd)) return;
|
|
33557
33686
|
daemonLog(
|
|
33558
33687
|
`${sessionId ? `session ${sessionId}` : "pty"} not spawned: working directory ${cwd} no longer exists`
|
|
33559
33688
|
);
|
|
@@ -33632,12 +33761,12 @@ function serverRunMeta(runName, cwd) {
|
|
|
33632
33761
|
|
|
33633
33762
|
// src/commands/sessions/daemon/readDesignSystemPrompt.ts
|
|
33634
33763
|
import * as fs49 from "fs";
|
|
33635
|
-
import * as
|
|
33764
|
+
import * as path79 from "path";
|
|
33636
33765
|
import { fileURLToPath as fileURLToPath10 } from "url";
|
|
33637
33766
|
var __filename5 = fileURLToPath10(import.meta.url);
|
|
33638
|
-
var __dirname7 =
|
|
33767
|
+
var __dirname7 = path79.dirname(__filename5);
|
|
33639
33768
|
function readDesignSystemPrompt() {
|
|
33640
|
-
const promptPath =
|
|
33769
|
+
const promptPath = path79.join(
|
|
33641
33770
|
__dirname7,
|
|
33642
33771
|
"..",
|
|
33643
33772
|
"claude",
|
|
@@ -33735,15 +33864,15 @@ function setStatus2(session, newStatus) {
|
|
|
33735
33864
|
}
|
|
33736
33865
|
|
|
33737
33866
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
33738
|
-
import { existsSync as
|
|
33867
|
+
import { existsSync as existsSync82 } from "fs";
|
|
33739
33868
|
import { basename as basename22 } from "path";
|
|
33740
33869
|
|
|
33741
33870
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
33742
|
-
import { existsSync as
|
|
33871
|
+
import { existsSync as existsSync81 } from "fs";
|
|
33743
33872
|
import { join as join93 } from "path";
|
|
33744
33873
|
|
|
33745
33874
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
33746
|
-
import { statSync as
|
|
33875
|
+
import { statSync as statSync14 } from "fs";
|
|
33747
33876
|
import { rm as rm2 } from "fs/promises";
|
|
33748
33877
|
import { join as join92 } from "path";
|
|
33749
33878
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
@@ -33773,7 +33902,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
33773
33902
|
return { removed: true };
|
|
33774
33903
|
}
|
|
33775
33904
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
33776
|
-
return
|
|
33905
|
+
return statSync14(join92(worktreePath, ".git"), {
|
|
33777
33906
|
throwIfNoEntry: false
|
|
33778
33907
|
})?.isDirectory() === true;
|
|
33779
33908
|
}
|
|
@@ -33809,7 +33938,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
33809
33938
|
);
|
|
33810
33939
|
}
|
|
33811
33940
|
function strandedReason(worktreePath, cause) {
|
|
33812
|
-
if (!
|
|
33941
|
+
if (!existsSync81(join93(worktreePath, ".git")))
|
|
33813
33942
|
return "its .git link is already gone";
|
|
33814
33943
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
33815
33944
|
return "git no longer recognises it as a working tree";
|
|
@@ -33861,7 +33990,7 @@ function reason3(error) {
|
|
|
33861
33990
|
|
|
33862
33991
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
33863
33992
|
async function reapWorktree(worktreePath, force = false) {
|
|
33864
|
-
if (!
|
|
33993
|
+
if (!existsSync82(worktreePath)) {
|
|
33865
33994
|
forgetWorktree(worktreePath);
|
|
33866
33995
|
daemonLog(
|
|
33867
33996
|
`worktree ${worktreePath} already gone; its record was forgotten`
|
|
@@ -33886,7 +34015,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
33886
34015
|
}
|
|
33887
34016
|
function owningClone(worktreePath) {
|
|
33888
34017
|
const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
|
|
33889
|
-
if (recorded &&
|
|
34018
|
+
if (recorded && existsSync82(recorded)) return recorded;
|
|
33890
34019
|
const detected = mainWorktree(worktreePath);
|
|
33891
34020
|
if (detected) return detected;
|
|
33892
34021
|
daemonLog(
|
|
@@ -34017,12 +34146,12 @@ function closeGateApplies(sessions, session) {
|
|
|
34017
34146
|
}
|
|
34018
34147
|
|
|
34019
34148
|
// src/commands/sessions/daemon/worktree/watchGitState.ts
|
|
34020
|
-
import { existsSync as
|
|
34149
|
+
import { existsSync as existsSync83, watch } from "fs";
|
|
34021
34150
|
var DEBOUNCE_MS = 500;
|
|
34022
34151
|
var POLL_MS = 3e4;
|
|
34023
34152
|
function watchGitState(cwd, onChange) {
|
|
34024
34153
|
const common = gitCommonDir(cwd);
|
|
34025
|
-
if (!common || !
|
|
34154
|
+
if (!common || !existsSync83(common)) return void 0;
|
|
34026
34155
|
const watchers = [
|
|
34027
34156
|
watchGitDir(common, onChange),
|
|
34028
34157
|
pollGitState(cwd, onChange)
|
|
@@ -34499,10 +34628,10 @@ function emitSessionOutput(session, clients, data) {
|
|
|
34499
34628
|
}
|
|
34500
34629
|
|
|
34501
34630
|
// src/commands/sessions/daemon/exitReason.ts
|
|
34502
|
-
import { existsSync as
|
|
34631
|
+
import { existsSync as existsSync84 } from "fs";
|
|
34503
34632
|
import { resolve as resolve22 } from "path";
|
|
34504
34633
|
function exitDetail(session) {
|
|
34505
|
-
if (session.cwd && !
|
|
34634
|
+
if (session.cwd && !existsSync84(session.cwd))
|
|
34506
34635
|
return `working directory ${session.cwd} no longer exists`;
|
|
34507
34636
|
return missingRunConfigCwd(session);
|
|
34508
34637
|
}
|
|
@@ -34516,7 +34645,7 @@ function missingRunConfigCwd(session) {
|
|
|
34516
34645
|
const config = resolveRunConfig(session.runName, dir);
|
|
34517
34646
|
if (!config?.cwd) return void 0;
|
|
34518
34647
|
const configured = resolve22(runConfigBaseDirFrom(dir), config.cwd);
|
|
34519
|
-
if (
|
|
34648
|
+
if (existsSync84(configured)) return void 0;
|
|
34520
34649
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
34521
34650
|
}
|
|
34522
34651
|
|
|
@@ -34557,7 +34686,7 @@ function handleFailedResume(session, exitCode, onStatusChange) {
|
|
|
34557
34686
|
}
|
|
34558
34687
|
|
|
34559
34688
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
34560
|
-
import { existsSync as
|
|
34689
|
+
import { existsSync as existsSync85, mkdirSync as mkdirSync33, watch as watch2 } from "fs";
|
|
34561
34690
|
import { dirname as dirname39 } from "path";
|
|
34562
34691
|
|
|
34563
34692
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
@@ -34619,8 +34748,8 @@ async function seedRunningMsFromUsage(session, notify2) {
|
|
|
34619
34748
|
var DEBOUNCE_MS2 = 50;
|
|
34620
34749
|
function watchActivity(session, notify2, onClaudeSessionId) {
|
|
34621
34750
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
34622
|
-
const
|
|
34623
|
-
const dir = dirname39(
|
|
34751
|
+
const path83 = activityPath(session.id);
|
|
34752
|
+
const dir = dirname39(path83);
|
|
34624
34753
|
try {
|
|
34625
34754
|
mkdirSync33(dir, { recursive: true });
|
|
34626
34755
|
} catch {
|
|
@@ -34630,7 +34759,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
34630
34759
|
let timer = null;
|
|
34631
34760
|
const read2 = () => {
|
|
34632
34761
|
timer = null;
|
|
34633
|
-
const activity2 = readActivity(
|
|
34762
|
+
const activity2 = readActivity(path83);
|
|
34634
34763
|
if (!activity2) return;
|
|
34635
34764
|
applyActivityToSession(session, activity2);
|
|
34636
34765
|
if (activity2.claudeSessionId) onClaudeSessionId?.(session);
|
|
@@ -34639,11 +34768,11 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
34639
34768
|
notify2();
|
|
34640
34769
|
};
|
|
34641
34770
|
session.activityWatcher = watch2(dir, (_event, filename) => {
|
|
34642
|
-
if (filename && !
|
|
34771
|
+
if (filename && !path83.endsWith(filename)) return;
|
|
34643
34772
|
if (timer) clearTimeout(timer);
|
|
34644
34773
|
timer = setTimeout(read2, DEBOUNCE_MS2);
|
|
34645
34774
|
});
|
|
34646
|
-
if (
|
|
34775
|
+
if (existsSync85(path83)) read2();
|
|
34647
34776
|
}
|
|
34648
34777
|
function refreshActivity(session) {
|
|
34649
34778
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -34786,12 +34915,12 @@ import { watch as watch3 } from "fs";
|
|
|
34786
34915
|
|
|
34787
34916
|
// src/commands/sessions/shared/findTranscriptPathSync.ts
|
|
34788
34917
|
import * as fs51 from "fs";
|
|
34789
|
-
import * as
|
|
34918
|
+
import * as path80 from "path";
|
|
34790
34919
|
function projectDirForCwd(cwd) {
|
|
34791
|
-
return
|
|
34920
|
+
return path80.join(claudeProjectsRoot(), projectSlug(cwd));
|
|
34792
34921
|
}
|
|
34793
34922
|
function transcriptPathFor(cwd, claudeSessionId) {
|
|
34794
|
-
return
|
|
34923
|
+
return path80.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
|
|
34795
34924
|
}
|
|
34796
34925
|
function findTranscriptPathSync(cwd, claudeSessionId) {
|
|
34797
34926
|
const direct = transcriptPathFor(cwd, claudeSessionId);
|
|
@@ -34805,8 +34934,8 @@ function findTranscriptPathSync(cwd, claudeSessionId) {
|
|
|
34805
34934
|
}
|
|
34806
34935
|
for (const file of files) {
|
|
34807
34936
|
if (!file.endsWith(".jsonl")) continue;
|
|
34808
|
-
if (headContainsSessionId(
|
|
34809
|
-
return
|
|
34937
|
+
if (headContainsSessionId(path80.join(dir, file), claudeSessionId))
|
|
34938
|
+
return path80.join(dir, file);
|
|
34810
34939
|
}
|
|
34811
34940
|
return null;
|
|
34812
34941
|
}
|
|
@@ -35980,9 +36109,9 @@ function tempRoots() {
|
|
|
35980
36109
|
}
|
|
35981
36110
|
return [...roots];
|
|
35982
36111
|
}
|
|
35983
|
-
function underTempRoot(
|
|
36112
|
+
function underTempRoot(path83) {
|
|
35984
36113
|
return tempRoots().some(
|
|
35985
|
-
(root) =>
|
|
36114
|
+
(root) => path83.startsWith(root.endsWith(sep2) ? root : root + sep2)
|
|
35986
36115
|
);
|
|
35987
36116
|
}
|
|
35988
36117
|
|
|
@@ -36294,7 +36423,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
36294
36423
|
}
|
|
36295
36424
|
|
|
36296
36425
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
36297
|
-
import { existsSync as
|
|
36426
|
+
import { existsSync as existsSync88 } from "fs";
|
|
36298
36427
|
import { basename as basename24 } from "path";
|
|
36299
36428
|
|
|
36300
36429
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
@@ -36349,18 +36478,18 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
36349
36478
|
}
|
|
36350
36479
|
|
|
36351
36480
|
// src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
|
|
36352
|
-
import { existsSync as
|
|
36481
|
+
import { existsSync as existsSync87 } from "fs";
|
|
36353
36482
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
36354
|
-
if (!
|
|
36355
|
-
for (const { path:
|
|
36483
|
+
if (!existsSync87(clone)) {
|
|
36484
|
+
for (const { path: path83 } of paths) forgetWorktree(path83);
|
|
36356
36485
|
daemonLog(
|
|
36357
36486
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
36358
36487
|
);
|
|
36359
36488
|
return;
|
|
36360
36489
|
}
|
|
36361
36490
|
await pruneBookkeeping2(clone);
|
|
36362
|
-
for (const { path:
|
|
36363
|
-
if (await reclaimBranch(clone, branch2)) forgetWorktree(
|
|
36491
|
+
for (const { path: path83, branch: branch2 } of paths)
|
|
36492
|
+
if (await reclaimBranch(clone, branch2)) forgetWorktree(path83);
|
|
36364
36493
|
}
|
|
36365
36494
|
async function pruneBookkeeping2(clone) {
|
|
36366
36495
|
try {
|
|
@@ -36387,37 +36516,37 @@ async function reclaimBranch(clone, branch2) {
|
|
|
36387
36516
|
}
|
|
36388
36517
|
|
|
36389
36518
|
// src/commands/sessions/daemon/worktree/logVanishedTree.ts
|
|
36390
|
-
function logVanishedTree(sessions,
|
|
36519
|
+
function logVanishedTree(sessions, path83) {
|
|
36391
36520
|
const claimants = [...sessions.values()].filter(
|
|
36392
|
-
(s) => s.cwd ===
|
|
36521
|
+
(s) => s.cwd === path83 || s.worktree?.path === path83
|
|
36393
36522
|
);
|
|
36394
36523
|
if (claimants.length === 0) {
|
|
36395
|
-
daemonLog(`worktree ${
|
|
36524
|
+
daemonLog(`worktree ${path83} gone from disk and unclaimed; reclaiming it`);
|
|
36396
36525
|
return;
|
|
36397
36526
|
}
|
|
36398
36527
|
for (const s of claimants)
|
|
36399
36528
|
daemonLog(
|
|
36400
|
-
`session ${s.id} ("${s.name}") claims worktree ${
|
|
36529
|
+
`session ${s.id} ("${s.name}") claims worktree ${path83}, which is gone from disk; reclaiming it`
|
|
36401
36530
|
);
|
|
36402
36531
|
}
|
|
36403
36532
|
|
|
36404
36533
|
// src/commands/sessions/daemon/worktree/describeHeldWork.ts
|
|
36405
36534
|
var MAX_ITEMS = 20;
|
|
36406
|
-
async function describeHeldWork(
|
|
36407
|
-
if (reason4.startsWith("uncommitted")) return await changedFiles(
|
|
36408
|
-
if (reason4.startsWith("unpushed")) return await unpushedCommits(
|
|
36535
|
+
async function describeHeldWork(path83, reason4) {
|
|
36536
|
+
if (reason4.startsWith("uncommitted")) return await changedFiles(path83);
|
|
36537
|
+
if (reason4.startsWith("unpushed")) return await unpushedCommits(path83, reason4);
|
|
36409
36538
|
return { summary: reason4, items: [] };
|
|
36410
36539
|
}
|
|
36411
|
-
async function changedFiles(
|
|
36412
|
-
const status3 = await gitResult(
|
|
36540
|
+
async function changedFiles(path83) {
|
|
36541
|
+
const status3 = await gitResult(path83, ["status", "--porcelain"]);
|
|
36413
36542
|
const lines2 = status3.ok ? nonEmptyLines(status3.out) : [];
|
|
36414
36543
|
return {
|
|
36415
36544
|
summary: `${lines2.length} uncommitted ${lines2.length === 1 ? "file" : "files"}`,
|
|
36416
36545
|
items: capped(lines2)
|
|
36417
36546
|
};
|
|
36418
36547
|
}
|
|
36419
|
-
async function unpushedCommits(
|
|
36420
|
-
const log2 = await gitResult(
|
|
36548
|
+
async function unpushedCommits(path83, reason4) {
|
|
36549
|
+
const log2 = await gitResult(path83, ["log", "--oneline", "@{upstream}..HEAD"]);
|
|
36421
36550
|
if (!log2.ok) return { summary: reason4, items: [] };
|
|
36422
36551
|
const lines2 = nonEmptyLines(log2.out);
|
|
36423
36552
|
return {
|
|
@@ -36509,24 +36638,24 @@ function reconcileWorktreesOnRestore(sessions, spawnWith, notify2) {
|
|
|
36509
36638
|
async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
36510
36639
|
const accounted = accountedTrees(sessions);
|
|
36511
36640
|
const vanished = /* @__PURE__ */ new Map();
|
|
36512
|
-
for (const { path:
|
|
36513
|
-
if (underTempRoot(
|
|
36514
|
-
forgetWorktree(
|
|
36641
|
+
for (const { path: path83, clone } of readWorktreeRegistry()) {
|
|
36642
|
+
if (underTempRoot(path83)) {
|
|
36643
|
+
forgetWorktree(path83);
|
|
36515
36644
|
daemonLog(
|
|
36516
|
-
`worktree ${
|
|
36645
|
+
`worktree ${path83} lies outside any project root; pruned from the registry rather than recovered`
|
|
36517
36646
|
);
|
|
36518
36647
|
continue;
|
|
36519
36648
|
}
|
|
36520
|
-
if (!
|
|
36521
|
-
logVanishedTree(sessions,
|
|
36649
|
+
if (!existsSync88(path83)) {
|
|
36650
|
+
logVanishedTree(sessions, path83);
|
|
36522
36651
|
vanished.set(clone, [
|
|
36523
36652
|
...vanished.get(clone) ?? [],
|
|
36524
|
-
{ path:
|
|
36653
|
+
{ path: path83, branch: basename24(path83) }
|
|
36525
36654
|
]);
|
|
36526
36655
|
continue;
|
|
36527
36656
|
}
|
|
36528
|
-
if (accounted.has(
|
|
36529
|
-
await recoverOrphan(sessions, spawnWith, { path:
|
|
36657
|
+
if (accounted.has(path83)) continue;
|
|
36658
|
+
await recoverOrphan(sessions, spawnWith, { path: path83, clone }, notify2);
|
|
36530
36659
|
}
|
|
36531
36660
|
for (const [clone, paths] of vanished)
|
|
36532
36661
|
await reclaimVanishedWorktrees(clone, paths);
|
|
@@ -37134,14 +37263,14 @@ async function defaultConnect() {
|
|
|
37134
37263
|
}
|
|
37135
37264
|
|
|
37136
37265
|
// src/commands/sessions/daemon/hasPersistedWindowsSessions.ts
|
|
37137
|
-
import { existsSync as
|
|
37266
|
+
import { existsSync as existsSync89, readFileSync as readFileSync59 } from "fs";
|
|
37138
37267
|
import { posix as posix3 } from "path";
|
|
37139
37268
|
function hasPersistedWindowsSessions() {
|
|
37140
37269
|
const sessionsFile = windowsSessionsFileFromWsl();
|
|
37141
37270
|
if (!sessionsFile) return false;
|
|
37142
37271
|
try {
|
|
37143
|
-
if (!
|
|
37144
|
-
const data = JSON.parse(
|
|
37272
|
+
if (!existsSync89(sessionsFile)) return false;
|
|
37273
|
+
const data = JSON.parse(readFileSync59(sessionsFile, "utf8"));
|
|
37145
37274
|
return Array.isArray(data) && data.length > 0;
|
|
37146
37275
|
} catch (error) {
|
|
37147
37276
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
@@ -37875,7 +38004,7 @@ function setAutoAdvance(sessions, id, enabled) {
|
|
|
37875
38004
|
}
|
|
37876
38005
|
|
|
37877
38006
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
37878
|
-
import { existsSync as
|
|
38007
|
+
import { existsSync as existsSync92 } from "fs";
|
|
37879
38008
|
|
|
37880
38009
|
// src/commands/sessions/daemon/resumeSession.ts
|
|
37881
38010
|
function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
@@ -37906,10 +38035,10 @@ function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
|
37906
38035
|
}
|
|
37907
38036
|
|
|
37908
38037
|
// src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
|
|
37909
|
-
import { existsSync as
|
|
38038
|
+
import { existsSync as existsSync91 } from "fs";
|
|
37910
38039
|
|
|
37911
38040
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
37912
|
-
import { copyFileSync as copyFileSync7, existsSync as
|
|
38041
|
+
import { copyFileSync as copyFileSync7, existsSync as existsSync90, mkdirSync as mkdirSync35 } from "fs";
|
|
37913
38042
|
import { join as join95 } from "path";
|
|
37914
38043
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
37915
38044
|
const dir = projectDirForCwd(toCwd);
|
|
@@ -37920,7 +38049,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
37920
38049
|
return;
|
|
37921
38050
|
}
|
|
37922
38051
|
const dest = join95(dir, `${claudeSessionId}.jsonl`);
|
|
37923
|
-
if (
|
|
38052
|
+
if (existsSync90(dest)) {
|
|
37924
38053
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
37925
38054
|
return;
|
|
37926
38055
|
}
|
|
@@ -37971,7 +38100,7 @@ function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name, harness
|
|
|
37971
38100
|
}
|
|
37972
38101
|
function cloneForReapedTree(missingCwd) {
|
|
37973
38102
|
const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
|
|
37974
|
-
if (!clone || !
|
|
38103
|
+
if (!clone || !existsSync91(clone))
|
|
37975
38104
|
throw new Error(
|
|
37976
38105
|
`working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
|
|
37977
38106
|
);
|
|
@@ -37980,7 +38109,7 @@ function cloneForReapedTree(missingCwd) {
|
|
|
37980
38109
|
|
|
37981
38110
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
37982
38111
|
function resumeInTree(ctx, sessionId, cwd, name, harness) {
|
|
37983
|
-
if (!
|
|
38112
|
+
if (!existsSync92(cwd))
|
|
37984
38113
|
return resumeInReplacementTree(ctx, sessionId, cwd, name, harness);
|
|
37985
38114
|
const id = ctx.spawnWith(
|
|
37986
38115
|
(sid) => resumeSession(sid, sessionId, cwd, name, void 0, harness)
|
|
@@ -38247,12 +38376,12 @@ function handleSetStatus(client, m, d) {
|
|
|
38247
38376
|
import * as fs54 from "fs";
|
|
38248
38377
|
|
|
38249
38378
|
// src/commands/sessions/shared/codex/findCodexRolloutPath.ts
|
|
38250
|
-
import * as
|
|
38379
|
+
import * as path81 from "path";
|
|
38251
38380
|
async function findCodexRolloutPath(sessionId) {
|
|
38252
38381
|
if (!sessionId) return null;
|
|
38253
38382
|
const paths = await discoverCodexRolloutPaths();
|
|
38254
38383
|
const suffix = `-${sessionId}.jsonl`;
|
|
38255
|
-
return paths.find((file) =>
|
|
38384
|
+
return paths.find((file) => path81.basename(file).endsWith(suffix)) ?? null;
|
|
38256
38385
|
}
|
|
38257
38386
|
|
|
38258
38387
|
// src/commands/sessions/shared/codex/codexToolTarget.ts
|
|
@@ -38560,7 +38689,7 @@ function handleConnection(socket, manager) {
|
|
|
38560
38689
|
import { unlinkSync as unlinkSync23, writeFileSync as writeFileSync48 } from "fs";
|
|
38561
38690
|
|
|
38562
38691
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
38563
|
-
import { readFileSync as
|
|
38692
|
+
import { readFileSync as readFileSync60 } from "fs";
|
|
38564
38693
|
var WATCHDOG_INTERVAL_MS = 5e3;
|
|
38565
38694
|
function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
38566
38695
|
const timer = setInterval(() => {
|
|
@@ -38571,7 +38700,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
|
38571
38700
|
}
|
|
38572
38701
|
function ownsPidFile() {
|
|
38573
38702
|
try {
|
|
38574
|
-
return
|
|
38703
|
+
return readFileSync60(daemonPaths.pid, "utf8").trim() === String(process.pid);
|
|
38575
38704
|
} catch {
|
|
38576
38705
|
return false;
|
|
38577
38706
|
}
|
|
@@ -38821,7 +38950,7 @@ function registerSetStatusCommand(cmd) {
|
|
|
38821
38950
|
|
|
38822
38951
|
// src/commands/sessions/summarise/index.ts
|
|
38823
38952
|
import * as fs56 from "fs";
|
|
38824
|
-
import
|
|
38953
|
+
import chalk224 from "chalk";
|
|
38825
38954
|
|
|
38826
38955
|
// src/commands/sessions/summarise/shared.ts
|
|
38827
38956
|
import * as fs55 from "fs";
|
|
@@ -38880,22 +39009,22 @@ ${firstMessage}`);
|
|
|
38880
39009
|
async function summarise2(options2) {
|
|
38881
39010
|
const files = await discoverSessionFiles();
|
|
38882
39011
|
if (files.length === 0) {
|
|
38883
|
-
console.log(
|
|
39012
|
+
console.log(chalk224.yellow("No sessions found."));
|
|
38884
39013
|
return;
|
|
38885
39014
|
}
|
|
38886
39015
|
const toProcess = selectCandidates(files, options2);
|
|
38887
39016
|
if (toProcess.length === 0) {
|
|
38888
|
-
console.log(
|
|
39017
|
+
console.log(chalk224.green("All sessions already summarised."));
|
|
38889
39018
|
return;
|
|
38890
39019
|
}
|
|
38891
39020
|
console.log(
|
|
38892
|
-
|
|
39021
|
+
chalk224.cyan(
|
|
38893
39022
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
38894
39023
|
)
|
|
38895
39024
|
);
|
|
38896
39025
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
38897
39026
|
console.log(
|
|
38898
|
-
|
|
39027
|
+
chalk224.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk224.yellow(`, ${failed2} skipped`) : "")
|
|
38899
39028
|
);
|
|
38900
39029
|
}
|
|
38901
39030
|
function selectCandidates(files, options2) {
|
|
@@ -38915,16 +39044,16 @@ function processSessions(files) {
|
|
|
38915
39044
|
let failed2 = 0;
|
|
38916
39045
|
for (let i = 0; i < files.length; i++) {
|
|
38917
39046
|
const file = files[i];
|
|
38918
|
-
process.stdout.write(
|
|
39047
|
+
process.stdout.write(chalk224.dim(` [${i + 1}/${files.length}] `));
|
|
38919
39048
|
const summary = summariseSession(file);
|
|
38920
39049
|
if (summary) {
|
|
38921
39050
|
writeSummary(file, summary);
|
|
38922
39051
|
succeeded++;
|
|
38923
|
-
process.stdout.write(`${
|
|
39052
|
+
process.stdout.write(`${chalk224.green("\u2713")} ${summary}
|
|
38924
39053
|
`);
|
|
38925
39054
|
} else {
|
|
38926
39055
|
failed2++;
|
|
38927
|
-
process.stdout.write(` ${
|
|
39056
|
+
process.stdout.write(` ${chalk224.yellow("skip")}
|
|
38928
39057
|
`);
|
|
38929
39058
|
}
|
|
38930
39059
|
}
|
|
@@ -38945,7 +39074,7 @@ function registerSessions(program2) {
|
|
|
38945
39074
|
}
|
|
38946
39075
|
|
|
38947
39076
|
// src/commands/statusLine.ts
|
|
38948
|
-
import
|
|
39077
|
+
import chalk226 from "chalk";
|
|
38949
39078
|
|
|
38950
39079
|
// src/shared/contextLevel.ts
|
|
38951
39080
|
function contextLevel(pct) {
|
|
@@ -38955,7 +39084,7 @@ function contextLevel(pct) {
|
|
|
38955
39084
|
}
|
|
38956
39085
|
|
|
38957
39086
|
// src/commands/buildLimitsSegment.ts
|
|
38958
|
-
import
|
|
39087
|
+
import chalk225 from "chalk";
|
|
38959
39088
|
|
|
38960
39089
|
// src/shared/rateLimitLevel.ts
|
|
38961
39090
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -38993,9 +39122,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
38993
39122
|
|
|
38994
39123
|
// src/commands/buildLimitsSegment.ts
|
|
38995
39124
|
var LEVEL_COLOR = {
|
|
38996
|
-
ok:
|
|
38997
|
-
warn:
|
|
38998
|
-
over:
|
|
39125
|
+
ok: chalk225.green,
|
|
39126
|
+
warn: chalk225.yellow,
|
|
39127
|
+
over: chalk225.red
|
|
38999
39128
|
};
|
|
39000
39129
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
39001
39130
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -39026,13 +39155,13 @@ function buildLimitsSegment(rateLimits) {
|
|
|
39026
39155
|
}
|
|
39027
39156
|
|
|
39028
39157
|
// src/commands/readGitBranch.ts
|
|
39029
|
-
import { readFileSync as
|
|
39158
|
+
import { readFileSync as readFileSync62, statSync as statSync16 } from "fs";
|
|
39030
39159
|
import { isAbsolute as isAbsolute5, join as join96, resolve as resolve23 } from "path";
|
|
39031
39160
|
function resolveGitDir(cwd) {
|
|
39032
39161
|
const dotGit = join96(cwd, ".git");
|
|
39033
39162
|
let stat4;
|
|
39034
39163
|
try {
|
|
39035
|
-
stat4 =
|
|
39164
|
+
stat4 = statSync16(dotGit);
|
|
39036
39165
|
} catch {
|
|
39037
39166
|
return null;
|
|
39038
39167
|
}
|
|
@@ -39041,7 +39170,7 @@ function resolveGitDir(cwd) {
|
|
|
39041
39170
|
}
|
|
39042
39171
|
let contents;
|
|
39043
39172
|
try {
|
|
39044
|
-
contents =
|
|
39173
|
+
contents = readFileSync62(dotGit, "utf8");
|
|
39045
39174
|
} catch {
|
|
39046
39175
|
return null;
|
|
39047
39176
|
}
|
|
@@ -39059,7 +39188,7 @@ function readGitBranch(cwd) {
|
|
|
39059
39188
|
}
|
|
39060
39189
|
let head;
|
|
39061
39190
|
try {
|
|
39062
|
-
head =
|
|
39191
|
+
head = readFileSync62(join96(gitDir, "HEAD"), "utf8");
|
|
39063
39192
|
} catch {
|
|
39064
39193
|
return null;
|
|
39065
39194
|
}
|
|
@@ -39091,7 +39220,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
39091
39220
|
}
|
|
39092
39221
|
|
|
39093
39222
|
// src/commands/statusLine.ts
|
|
39094
|
-
|
|
39223
|
+
chalk226.level = 3;
|
|
39095
39224
|
function formatNumber(num) {
|
|
39096
39225
|
return num.toLocaleString("en-US");
|
|
39097
39226
|
}
|
|
@@ -39099,9 +39228,9 @@ function colorizePercent(pct) {
|
|
|
39099
39228
|
const label2 = `${Math.round(pct)}%`;
|
|
39100
39229
|
switch (contextLevel(pct)) {
|
|
39101
39230
|
case "red":
|
|
39102
|
-
return
|
|
39231
|
+
return chalk226.red(label2);
|
|
39103
39232
|
case "yellow":
|
|
39104
|
-
return
|
|
39233
|
+
return chalk226.yellow(label2);
|
|
39105
39234
|
default:
|
|
39106
39235
|
return label2;
|
|
39107
39236
|
}
|
|
@@ -39114,7 +39243,7 @@ async function statusLine() {
|
|
|
39114
39243
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
39115
39244
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
39116
39245
|
const branch2 = dir ? readGitBranch(toGitCwd(dir)) : null;
|
|
39117
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
39246
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk226.cyan(branch2)} | ` : "";
|
|
39118
39247
|
console.log(
|
|
39119
39248
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
39120
39249
|
);
|
|
@@ -39128,7 +39257,7 @@ async function statusLine() {
|
|
|
39128
39257
|
|
|
39129
39258
|
// src/commands/update.ts
|
|
39130
39259
|
import { execSync as execSync61 } from "child_process";
|
|
39131
|
-
import * as
|
|
39260
|
+
import * as path82 from "path";
|
|
39132
39261
|
|
|
39133
39262
|
// src/commands/restartDaemonAfterUpdate.ts
|
|
39134
39263
|
async function restartDaemonAfterUpdate() {
|
|
@@ -39147,12 +39276,12 @@ async function restartDaemonAfterUpdate() {
|
|
|
39147
39276
|
// src/commands/update.ts
|
|
39148
39277
|
function isGlobalNpmInstall(dir) {
|
|
39149
39278
|
try {
|
|
39150
|
-
const resolved =
|
|
39151
|
-
if (resolved.split(
|
|
39279
|
+
const resolved = path82.resolve(dir);
|
|
39280
|
+
if (resolved.split(path82.sep).includes("node_modules")) {
|
|
39152
39281
|
return true;
|
|
39153
39282
|
}
|
|
39154
39283
|
const globalPrefix = execSync61("npm prefix -g", { stdio: "pipe" }).toString().trim();
|
|
39155
|
-
return resolved.toLowerCase().startsWith(
|
|
39284
|
+
return resolved.toLowerCase().startsWith(path82.resolve(globalPrefix).toLowerCase());
|
|
39156
39285
|
} catch {
|
|
39157
39286
|
return false;
|
|
39158
39287
|
}
|
|
@@ -39184,10 +39313,10 @@ async function update2() {
|
|
|
39184
39313
|
}
|
|
39185
39314
|
|
|
39186
39315
|
// src/reportCliError.ts
|
|
39187
|
-
import
|
|
39316
|
+
import chalk227 from "chalk";
|
|
39188
39317
|
function reportCliError(error) {
|
|
39189
39318
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError) {
|
|
39190
|
-
console.error(
|
|
39319
|
+
console.error(chalk227.red(error.message));
|
|
39191
39320
|
} else {
|
|
39192
39321
|
console.error(error);
|
|
39193
39322
|
}
|
|
@@ -39239,6 +39368,7 @@ registerList(program);
|
|
|
39239
39368
|
registerVerify(program);
|
|
39240
39369
|
registerRefactor(program);
|
|
39241
39370
|
registerReview(program);
|
|
39371
|
+
registerRules(program);
|
|
39242
39372
|
registerDevlog(program);
|
|
39243
39373
|
registerDeploy(program);
|
|
39244
39374
|
registerComplexity(program);
|