@staff0rd/assist 0.592.1 → 0.594.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 -0
- 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 +669 -562
- 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.594.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;
|
|
@@ -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`);
|
|
@@ -30980,98 +31071,11 @@ function registerSync(program2) {
|
|
|
30980
31071
|
configHelp(syncCommand, rootConfigHelp.sync);
|
|
30981
31072
|
}
|
|
30982
31073
|
|
|
30983
|
-
// src/commands/transcript/
|
|
30984
|
-
import
|
|
30985
|
-
function createReadlineInterface() {
|
|
30986
|
-
return readline3.createInterface({
|
|
30987
|
-
input: process.stdin,
|
|
30988
|
-
output: process.stdout
|
|
30989
|
-
});
|
|
30990
|
-
}
|
|
30991
|
-
function askQuestion(rl, question) {
|
|
30992
|
-
return new Promise((resolve25) => {
|
|
30993
|
-
rl.question(question, (answer) => {
|
|
30994
|
-
resolve25(answer.trim());
|
|
30995
|
-
});
|
|
30996
|
-
});
|
|
30997
|
-
}
|
|
30998
|
-
|
|
30999
|
-
// src/commands/transcript/configure.ts
|
|
31000
|
-
function buildPrompt4(label2, current) {
|
|
31001
|
-
return current ? `${label2} [${current}]: ` : `${label2}: `;
|
|
31002
|
-
}
|
|
31003
|
-
function printExisting(existing) {
|
|
31004
|
-
console.log("Current configuration:");
|
|
31005
|
-
console.log(` VTT directory: ${existing.vttDir}`);
|
|
31006
|
-
console.log(` Transcripts directory: ${existing.transcriptsDir}`);
|
|
31007
|
-
console.log(` Summary directory: ${existing.summaryDir}`);
|
|
31008
|
-
console.log();
|
|
31009
|
-
}
|
|
31010
|
-
async function promptDirectories(rl, existing) {
|
|
31011
|
-
const vttDir = await askQuestion(
|
|
31012
|
-
rl,
|
|
31013
|
-
buildPrompt4("VTT directory", existing?.vttDir)
|
|
31014
|
-
);
|
|
31015
|
-
const transcriptsDir = await askQuestion(
|
|
31016
|
-
rl,
|
|
31017
|
-
buildPrompt4("Transcripts directory", existing?.transcriptsDir)
|
|
31018
|
-
);
|
|
31019
|
-
const summaryDir = await askQuestion(
|
|
31020
|
-
rl,
|
|
31021
|
-
buildPrompt4("Summary directory", existing?.summaryDir)
|
|
31022
|
-
);
|
|
31023
|
-
return {
|
|
31024
|
-
vttDir: vttDir || existing?.vttDir || "",
|
|
31025
|
-
transcriptsDir: transcriptsDir || existing?.transcriptsDir || "",
|
|
31026
|
-
summaryDir: summaryDir || existing?.summaryDir || ""
|
|
31027
|
-
};
|
|
31028
|
-
}
|
|
31029
|
-
function validateDirectories(transcript) {
|
|
31030
|
-
if (!transcript.vttDir || !transcript.transcriptsDir || !transcript.summaryDir) {
|
|
31031
|
-
console.error("\nError: All directories must be specified.");
|
|
31032
|
-
process.exit(1);
|
|
31033
|
-
}
|
|
31034
|
-
}
|
|
31035
|
-
async function configure() {
|
|
31036
|
-
const rl = createReadlineInterface();
|
|
31037
|
-
const config = loadProjectConfig();
|
|
31038
|
-
const existing = config.transcript;
|
|
31039
|
-
console.log("Configure transcript directories\n");
|
|
31040
|
-
if (existing) printExisting(existing);
|
|
31041
|
-
try {
|
|
31042
|
-
const transcript = await promptDirectories(rl, existing);
|
|
31043
|
-
rl.close();
|
|
31044
|
-
validateDirectories(transcript);
|
|
31045
|
-
saveConfig({ ...config, transcript });
|
|
31046
|
-
console.log("\nConfiguration saved.");
|
|
31047
|
-
} catch (error) {
|
|
31048
|
-
rl.close();
|
|
31049
|
-
throw error;
|
|
31050
|
-
}
|
|
31051
|
-
}
|
|
31052
|
-
|
|
31053
|
-
// src/commands/transcript/list.ts
|
|
31054
|
-
import { existsSync as existsSync64, readdirSync as readdirSync19, statSync as statSync10 } from "fs";
|
|
31055
|
-
import { join as join78 } from "path";
|
|
31056
|
-
function list4() {
|
|
31057
|
-
const { vttDir } = getTranscriptConfig();
|
|
31058
|
-
if (!existsSync64(vttDir)) return;
|
|
31059
|
-
for (const entry of readdirSync19(vttDir)) {
|
|
31060
|
-
if (!entry.endsWith(".vtt")) continue;
|
|
31061
|
-
if (statSync10(join78(vttDir, entry)).isDirectory()) continue;
|
|
31062
|
-
console.log(entry);
|
|
31063
|
-
}
|
|
31064
|
-
}
|
|
31074
|
+
// src/commands/transcript/clean.ts
|
|
31075
|
+
import { existsSync as existsSync66 } from "fs";
|
|
31065
31076
|
|
|
31066
|
-
// src/commands/transcript/
|
|
31067
|
-
import {
|
|
31068
|
-
existsSync as existsSync65,
|
|
31069
|
-
mkdirSync as mkdirSync27,
|
|
31070
|
-
readFileSync as readFileSync50,
|
|
31071
|
-
renameSync as renameSync2,
|
|
31072
|
-
writeFileSync as writeFileSync43
|
|
31073
|
-
} from "fs";
|
|
31074
|
-
import { basename as basename21, join as join79 } from "path";
|
|
31077
|
+
// src/commands/transcript/convertVttToMarkdown.ts
|
|
31078
|
+
import { readFileSync as readFileSync51 } from "fs";
|
|
31075
31079
|
|
|
31076
31080
|
// src/commands/transcript/cleanText.ts
|
|
31077
31081
|
function cleanText(text18) {
|
|
@@ -31276,13 +31280,114 @@ function formatChatLog(messages) {
|
|
|
31276
31280
|
return messages.map((msg) => `${msg.speaker}: ${msg.text}`).join("\n\n");
|
|
31277
31281
|
}
|
|
31278
31282
|
|
|
31279
|
-
// src/commands/transcript/
|
|
31280
|
-
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
31283
|
+
// src/commands/transcript/convertVttToMarkdown.ts
|
|
31281
31284
|
function convertVttToMarkdown(inputPath) {
|
|
31282
|
-
const cues = parseVtt(
|
|
31285
|
+
const cues = parseVtt(readFileSync51(inputPath, "utf8"));
|
|
31283
31286
|
const messages = cuesToChatMessages(deduplicateCues(cues));
|
|
31284
31287
|
return formatChatLog(messages);
|
|
31285
31288
|
}
|
|
31289
|
+
|
|
31290
|
+
// src/commands/transcript/clean.ts
|
|
31291
|
+
function clean(file) {
|
|
31292
|
+
if (!existsSync66(file)) {
|
|
31293
|
+
console.error(`Error: VTT file not found: ${file}`);
|
|
31294
|
+
process.exit(1);
|
|
31295
|
+
}
|
|
31296
|
+
const markdown = convertVttToMarkdown(file);
|
|
31297
|
+
if (!markdown) {
|
|
31298
|
+
console.error(`Error: no cues found in: ${file}`);
|
|
31299
|
+
process.exit(1);
|
|
31300
|
+
}
|
|
31301
|
+
console.log(markdown);
|
|
31302
|
+
}
|
|
31303
|
+
|
|
31304
|
+
// src/commands/transcript/shared.ts
|
|
31305
|
+
import * as readline3 from "readline";
|
|
31306
|
+
function createReadlineInterface() {
|
|
31307
|
+
return readline3.createInterface({
|
|
31308
|
+
input: process.stdin,
|
|
31309
|
+
output: process.stdout
|
|
31310
|
+
});
|
|
31311
|
+
}
|
|
31312
|
+
function askQuestion(rl, question) {
|
|
31313
|
+
return new Promise((resolve25) => {
|
|
31314
|
+
rl.question(question, (answer) => {
|
|
31315
|
+
resolve25(answer.trim());
|
|
31316
|
+
});
|
|
31317
|
+
});
|
|
31318
|
+
}
|
|
31319
|
+
|
|
31320
|
+
// src/commands/transcript/configure.ts
|
|
31321
|
+
function buildPrompt4(label2, current) {
|
|
31322
|
+
return current ? `${label2} [${current}]: ` : `${label2}: `;
|
|
31323
|
+
}
|
|
31324
|
+
function printExisting(existing) {
|
|
31325
|
+
console.log("Current configuration:");
|
|
31326
|
+
console.log(` VTT directory: ${existing.vttDir}`);
|
|
31327
|
+
console.log(` Transcripts directory: ${existing.transcriptsDir}`);
|
|
31328
|
+
console.log(` Summary directory: ${existing.summaryDir}`);
|
|
31329
|
+
console.log();
|
|
31330
|
+
}
|
|
31331
|
+
async function promptDirectories(rl, existing) {
|
|
31332
|
+
const vttDir = await askQuestion(
|
|
31333
|
+
rl,
|
|
31334
|
+
buildPrompt4("VTT directory", existing?.vttDir)
|
|
31335
|
+
);
|
|
31336
|
+
const transcriptsDir = await askQuestion(
|
|
31337
|
+
rl,
|
|
31338
|
+
buildPrompt4("Transcripts directory", existing?.transcriptsDir)
|
|
31339
|
+
);
|
|
31340
|
+
const summaryDir = await askQuestion(
|
|
31341
|
+
rl,
|
|
31342
|
+
buildPrompt4("Summary directory", existing?.summaryDir)
|
|
31343
|
+
);
|
|
31344
|
+
return {
|
|
31345
|
+
vttDir: vttDir || existing?.vttDir || "",
|
|
31346
|
+
transcriptsDir: transcriptsDir || existing?.transcriptsDir || "",
|
|
31347
|
+
summaryDir: summaryDir || existing?.summaryDir || ""
|
|
31348
|
+
};
|
|
31349
|
+
}
|
|
31350
|
+
function validateDirectories(transcript) {
|
|
31351
|
+
if (!transcript.vttDir || !transcript.transcriptsDir || !transcript.summaryDir) {
|
|
31352
|
+
console.error("\nError: All directories must be specified.");
|
|
31353
|
+
process.exit(1);
|
|
31354
|
+
}
|
|
31355
|
+
}
|
|
31356
|
+
async function configure() {
|
|
31357
|
+
const rl = createReadlineInterface();
|
|
31358
|
+
const config = loadProjectConfig();
|
|
31359
|
+
const existing = config.transcript;
|
|
31360
|
+
console.log("Configure transcript directories\n");
|
|
31361
|
+
if (existing) printExisting(existing);
|
|
31362
|
+
try {
|
|
31363
|
+
const transcript = await promptDirectories(rl, existing);
|
|
31364
|
+
rl.close();
|
|
31365
|
+
validateDirectories(transcript);
|
|
31366
|
+
saveConfig({ ...config, transcript });
|
|
31367
|
+
console.log("\nConfiguration saved.");
|
|
31368
|
+
} catch (error) {
|
|
31369
|
+
rl.close();
|
|
31370
|
+
throw error;
|
|
31371
|
+
}
|
|
31372
|
+
}
|
|
31373
|
+
|
|
31374
|
+
// src/commands/transcript/list.ts
|
|
31375
|
+
import { existsSync as existsSync67, readdirSync as readdirSync19, statSync as statSync11 } from "fs";
|
|
31376
|
+
import { join as join78 } from "path";
|
|
31377
|
+
function list4() {
|
|
31378
|
+
const { vttDir } = getTranscriptConfig();
|
|
31379
|
+
if (!existsSync67(vttDir)) return;
|
|
31380
|
+
for (const entry of readdirSync19(vttDir)) {
|
|
31381
|
+
if (!entry.endsWith(".vtt")) continue;
|
|
31382
|
+
if (statSync11(join78(vttDir, entry)).isDirectory()) continue;
|
|
31383
|
+
console.log(entry);
|
|
31384
|
+
}
|
|
31385
|
+
}
|
|
31386
|
+
|
|
31387
|
+
// src/commands/transcript/move.ts
|
|
31388
|
+
import { existsSync as existsSync68, mkdirSync as mkdirSync27, renameSync as renameSync2, writeFileSync as writeFileSync43 } from "fs";
|
|
31389
|
+
import { basename as basename21, join as join79 } from "path";
|
|
31390
|
+
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
31286
31391
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
31287
31392
|
const processedDir = join79(vttDir, "processed");
|
|
31288
31393
|
mkdirSync27(processedDir, { recursive: true });
|
|
@@ -31297,7 +31402,7 @@ function move(file, options2) {
|
|
|
31297
31402
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
31298
31403
|
const filename = basename21(file);
|
|
31299
31404
|
const sourcePath = join79(vttDir, filename);
|
|
31300
|
-
if (!
|
|
31405
|
+
if (!existsSync68(sourcePath)) {
|
|
31301
31406
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
31302
31407
|
process.exit(1);
|
|
31303
31408
|
}
|
|
@@ -31319,6 +31424,7 @@ function registerTranscript(program2) {
|
|
|
31319
31424
|
configHelp(transcriptCommand, transcriptConfigHelp);
|
|
31320
31425
|
transcriptCommand.command("configure").description("Configure transcript directories").action(configure);
|
|
31321
31426
|
transcriptCommand.command("list").description("List raw .vtt filenames waiting in the pick-up directory").action(list4);
|
|
31427
|
+
transcriptCommand.command("clean <path>").description("Clean any .vtt file and write the chat log to stdout").action(clean);
|
|
31322
31428
|
transcriptCommand.command("move <file>").description(
|
|
31323
31429
|
"Convert a raw .vtt to a dated markdown transcript and archive the original"
|
|
31324
31430
|
).requiredOption("--date <YYYY-MM-DD>", "meeting date").requiredOption("--client <name>", "client name").action(move);
|
|
@@ -31426,14 +31532,14 @@ function devices() {
|
|
|
31426
31532
|
}
|
|
31427
31533
|
|
|
31428
31534
|
// src/commands/voice/logs.ts
|
|
31429
|
-
import { existsSync as
|
|
31535
|
+
import { existsSync as existsSync69, readFileSync as readFileSync52 } from "fs";
|
|
31430
31536
|
function logs(options2) {
|
|
31431
|
-
if (!
|
|
31537
|
+
if (!existsSync69(voicePaths.log)) {
|
|
31432
31538
|
console.log("No voice log file found");
|
|
31433
31539
|
return;
|
|
31434
31540
|
}
|
|
31435
31541
|
const count8 = Number.parseInt(options2.lines ?? "150", 10);
|
|
31436
|
-
const content =
|
|
31542
|
+
const content = readFileSync52(voicePaths.log, "utf8").trim();
|
|
31437
31543
|
if (!content) {
|
|
31438
31544
|
console.log("Voice log is empty");
|
|
31439
31545
|
return;
|
|
@@ -31460,7 +31566,7 @@ import { join as join83 } from "path";
|
|
|
31460
31566
|
|
|
31461
31567
|
// src/commands/voice/checkLockFile.ts
|
|
31462
31568
|
import { execSync as execSync58 } from "child_process";
|
|
31463
|
-
import { existsSync as
|
|
31569
|
+
import { existsSync as existsSync70, mkdirSync as mkdirSync28, readFileSync as readFileSync53, writeFileSync as writeFileSync44 } from "fs";
|
|
31464
31570
|
import { join as join82 } from "path";
|
|
31465
31571
|
function isProcessAlive2(pid) {
|
|
31466
31572
|
try {
|
|
@@ -31472,9 +31578,9 @@ function isProcessAlive2(pid) {
|
|
|
31472
31578
|
}
|
|
31473
31579
|
function checkLockFile() {
|
|
31474
31580
|
const lockFile = getLockFile();
|
|
31475
|
-
if (!
|
|
31581
|
+
if (!existsSync70(lockFile)) return;
|
|
31476
31582
|
try {
|
|
31477
|
-
const lock2 = JSON.parse(
|
|
31583
|
+
const lock2 = JSON.parse(readFileSync53(lockFile, "utf8"));
|
|
31478
31584
|
if (lock2.pid && isProcessAlive2(lock2.pid)) {
|
|
31479
31585
|
console.error(
|
|
31480
31586
|
`Voice daemon already running (PID ${lock2.pid}, env: ${lock2.env}). Stop it first with: assist voice stop`
|
|
@@ -31485,7 +31591,7 @@ function checkLockFile() {
|
|
|
31485
31591
|
}
|
|
31486
31592
|
}
|
|
31487
31593
|
function bootstrapVenv() {
|
|
31488
|
-
if (
|
|
31594
|
+
if (existsSync70(getVenvPython())) return;
|
|
31489
31595
|
console.log("Setting up Python environment...");
|
|
31490
31596
|
const pythonDir = getPythonDir();
|
|
31491
31597
|
execSync58(
|
|
@@ -31576,7 +31682,7 @@ function start2(options2) {
|
|
|
31576
31682
|
}
|
|
31577
31683
|
|
|
31578
31684
|
// src/commands/voice/status.ts
|
|
31579
|
-
import { existsSync as
|
|
31685
|
+
import { existsSync as existsSync71, readFileSync as readFileSync54 } from "fs";
|
|
31580
31686
|
function isProcessAlive3(pid) {
|
|
31581
31687
|
try {
|
|
31582
31688
|
process.kill(pid, 0);
|
|
@@ -31586,16 +31692,16 @@ function isProcessAlive3(pid) {
|
|
|
31586
31692
|
}
|
|
31587
31693
|
}
|
|
31588
31694
|
function readRecentLogs(count8) {
|
|
31589
|
-
if (!
|
|
31590
|
-
const lines2 =
|
|
31695
|
+
if (!existsSync71(voicePaths.log)) return [];
|
|
31696
|
+
const lines2 = readFileSync54(voicePaths.log, "utf8").trim().split("\n");
|
|
31591
31697
|
return lines2.slice(-count8);
|
|
31592
31698
|
}
|
|
31593
31699
|
function status2() {
|
|
31594
|
-
if (!
|
|
31700
|
+
if (!existsSync71(voicePaths.pid)) {
|
|
31595
31701
|
console.log("Voice daemon: not running (no PID file)");
|
|
31596
31702
|
return;
|
|
31597
31703
|
}
|
|
31598
|
-
const pid = Number.parseInt(
|
|
31704
|
+
const pid = Number.parseInt(readFileSync54(voicePaths.pid, "utf8").trim(), 10);
|
|
31599
31705
|
const alive = isProcessAlive3(pid);
|
|
31600
31706
|
console.log(`Voice daemon: ${alive ? "running" : "dead"} (PID ${pid})`);
|
|
31601
31707
|
const recent = readRecentLogs(5);
|
|
@@ -31614,13 +31720,13 @@ function status2() {
|
|
|
31614
31720
|
}
|
|
31615
31721
|
|
|
31616
31722
|
// src/commands/voice/stop.ts
|
|
31617
|
-
import { existsSync as
|
|
31723
|
+
import { existsSync as existsSync72, readFileSync as readFileSync55, unlinkSync as unlinkSync20 } from "fs";
|
|
31618
31724
|
function stop2() {
|
|
31619
|
-
if (!
|
|
31725
|
+
if (!existsSync72(voicePaths.pid)) {
|
|
31620
31726
|
console.log("Voice daemon is not running (no PID file)");
|
|
31621
31727
|
return;
|
|
31622
31728
|
}
|
|
31623
|
-
const pid = Number.parseInt(
|
|
31729
|
+
const pid = Number.parseInt(readFileSync55(voicePaths.pid, "utf8").trim(), 10);
|
|
31624
31730
|
try {
|
|
31625
31731
|
process.kill(pid, "SIGTERM");
|
|
31626
31732
|
console.log(`Sent SIGTERM to voice daemon (PID ${pid})`);
|
|
@@ -31633,7 +31739,7 @@ function stop2() {
|
|
|
31633
31739
|
}
|
|
31634
31740
|
try {
|
|
31635
31741
|
const lockFile = getLockFile();
|
|
31636
|
-
if (
|
|
31742
|
+
if (existsSync72(lockFile)) unlinkSync20(lockFile);
|
|
31637
31743
|
} catch {
|
|
31638
31744
|
}
|
|
31639
31745
|
console.log("Voice daemon stopped");
|
|
@@ -31758,11 +31864,11 @@ var webUiPrefix = "src/commands/sessions/web/ui/";
|
|
|
31758
31864
|
var sessionsPrefix = "src/commands/sessions/";
|
|
31759
31865
|
var rules = [
|
|
31760
31866
|
{
|
|
31761
|
-
matches: (
|
|
31867
|
+
matches: (path83) => path83.startsWith(webUiPrefix),
|
|
31762
31868
|
advice: "restart the web server, then hard-reload the browser tab"
|
|
31763
31869
|
},
|
|
31764
31870
|
{
|
|
31765
|
-
matches: (
|
|
31871
|
+
matches: (path83) => path83.startsWith(sessionsPrefix) && !path83.startsWith(webUiPrefix),
|
|
31766
31872
|
advice: "restart the daemon"
|
|
31767
31873
|
}
|
|
31768
31874
|
];
|
|
@@ -31773,31 +31879,31 @@ function restartAdvice(paths) {
|
|
|
31773
31879
|
// src/commands/watch/syncAdvice.ts
|
|
31774
31880
|
var rules2 = [
|
|
31775
31881
|
{
|
|
31776
|
-
matches: (
|
|
31882
|
+
matches: (path83) => path83.startsWith("claude/commands/"),
|
|
31777
31883
|
reason: "claude/commands changed"
|
|
31778
31884
|
},
|
|
31779
31885
|
{
|
|
31780
|
-
matches: (
|
|
31886
|
+
matches: (path83) => path83.startsWith("claude/skills/"),
|
|
31781
31887
|
reason: "claude/skills changed"
|
|
31782
31888
|
},
|
|
31783
31889
|
{
|
|
31784
|
-
matches: (
|
|
31890
|
+
matches: (path83) => path83 === "claude/settings.json",
|
|
31785
31891
|
reason: "claude/settings.json changed"
|
|
31786
31892
|
},
|
|
31787
31893
|
{
|
|
31788
|
-
matches: (
|
|
31894
|
+
matches: (path83) => path83 === "claude/CLAUDE.md",
|
|
31789
31895
|
reason: "claude/CLAUDE.md changed"
|
|
31790
31896
|
},
|
|
31791
31897
|
{
|
|
31792
|
-
matches: (
|
|
31898
|
+
matches: (path83) => path83 === "claude/design-system-prompt.md",
|
|
31793
31899
|
reason: "claude/design-system-prompt.md changed"
|
|
31794
31900
|
},
|
|
31795
31901
|
{
|
|
31796
|
-
matches: (
|
|
31902
|
+
matches: (path83) => path83.startsWith("codex/"),
|
|
31797
31903
|
reason: "codex sources changed"
|
|
31798
31904
|
},
|
|
31799
31905
|
{
|
|
31800
|
-
matches: (
|
|
31906
|
+
matches: (path83) => path83.startsWith("pi/"),
|
|
31801
31907
|
reason: "pi sources changed"
|
|
31802
31908
|
}
|
|
31803
31909
|
];
|
|
@@ -32038,7 +32144,7 @@ function resolveParams(params, cliArgs) {
|
|
|
32038
32144
|
}
|
|
32039
32145
|
|
|
32040
32146
|
// src/commands/run/resolveRunCwd.ts
|
|
32041
|
-
import { existsSync as
|
|
32147
|
+
import { existsSync as existsSync73 } from "fs";
|
|
32042
32148
|
import { resolve as resolve19 } from "path";
|
|
32043
32149
|
var MissingRunCwdError = class extends Error {
|
|
32044
32150
|
constructor(runName, cwd) {
|
|
@@ -32051,17 +32157,17 @@ var MissingRunCwdError = class extends Error {
|
|
|
32051
32157
|
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
32052
32158
|
if (!config.cwd) return void 0;
|
|
32053
32159
|
const cwd = resolve19(baseDir, config.cwd);
|
|
32054
|
-
if (!
|
|
32160
|
+
if (!existsSync73(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
32055
32161
|
return cwd;
|
|
32056
32162
|
}
|
|
32057
32163
|
|
|
32058
32164
|
// src/commands/run/runCommandToCompletion.ts
|
|
32059
32165
|
import { spawn as spawn9 } from "child_process";
|
|
32060
|
-
import { existsSync as
|
|
32166
|
+
import { existsSync as existsSync75 } from "fs";
|
|
32061
32167
|
|
|
32062
32168
|
// src/commands/run/resolveCommand.ts
|
|
32063
32169
|
import { execFileSync as execFileSync16 } from "child_process";
|
|
32064
|
-
import { existsSync as
|
|
32170
|
+
import { existsSync as existsSync74 } from "fs";
|
|
32065
32171
|
import { dirname as dirname37, join as join86, resolve as resolve20 } from "path";
|
|
32066
32172
|
function resolveCommand2(command) {
|
|
32067
32173
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
@@ -32069,7 +32175,7 @@ function resolveCommand2(command) {
|
|
|
32069
32175
|
const gitPath = execFileSync16("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
32070
32176
|
const gitRoot = resolve20(dirname37(gitPath), "..");
|
|
32071
32177
|
const gitBash = join86(gitRoot, "bin", "bash.exe");
|
|
32072
|
-
if (
|
|
32178
|
+
if (existsSync74(gitBash)) return gitBash;
|
|
32073
32179
|
} catch {
|
|
32074
32180
|
return command;
|
|
32075
32181
|
}
|
|
@@ -32079,7 +32185,7 @@ function resolveCommand2(command) {
|
|
|
32079
32185
|
// src/commands/run/runCommandToCompletion.ts
|
|
32080
32186
|
function runCommandToCompletion(command, args, env, cwd, quiet) {
|
|
32081
32187
|
return new Promise((resolveResult) => {
|
|
32082
|
-
if (cwd && !
|
|
32188
|
+
if (cwd && !existsSync75(cwd)) {
|
|
32083
32189
|
resolveResult({
|
|
32084
32190
|
kind: "failed",
|
|
32085
32191
|
message: `Failed to execute command: cwd ${cwd} does not exist`
|
|
@@ -32336,7 +32442,7 @@ function registerWatch(program2) {
|
|
|
32336
32442
|
|
|
32337
32443
|
// src/commands/roam/auth.ts
|
|
32338
32444
|
import { randomBytes } from "crypto";
|
|
32339
|
-
import
|
|
32445
|
+
import chalk222 from "chalk";
|
|
32340
32446
|
|
|
32341
32447
|
// src/commands/roam/waitForCallback.ts
|
|
32342
32448
|
import { createServer as createServer3 } from "http";
|
|
@@ -32467,13 +32573,13 @@ async function auth() {
|
|
|
32467
32573
|
saveGlobalConfig(config);
|
|
32468
32574
|
const state = randomBytes(16).toString("hex");
|
|
32469
32575
|
console.log(
|
|
32470
|
-
|
|
32576
|
+
chalk222.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
32471
32577
|
);
|
|
32472
|
-
console.log(
|
|
32473
|
-
console.log(
|
|
32474
|
-
console.log(
|
|
32578
|
+
console.log(chalk222.white("http://localhost:14523/callback\n"));
|
|
32579
|
+
console.log(chalk222.blue("Opening browser for authorization..."));
|
|
32580
|
+
console.log(chalk222.dim("Waiting for authorization callback..."));
|
|
32475
32581
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
32476
|
-
console.log(
|
|
32582
|
+
console.log(chalk222.dim("Exchanging code for tokens..."));
|
|
32477
32583
|
const tokens = await exchangeToken({
|
|
32478
32584
|
code,
|
|
32479
32585
|
clientId,
|
|
@@ -32489,13 +32595,13 @@ async function auth() {
|
|
|
32489
32595
|
};
|
|
32490
32596
|
saveGlobalConfig(config);
|
|
32491
32597
|
console.log(
|
|
32492
|
-
|
|
32598
|
+
chalk222.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
32493
32599
|
);
|
|
32494
32600
|
}
|
|
32495
32601
|
|
|
32496
32602
|
// src/commands/roam/postRoamActivity.ts
|
|
32497
32603
|
import { execFileSync as execFileSync18 } from "child_process";
|
|
32498
|
-
import { readdirSync as readdirSync20, readFileSync as
|
|
32604
|
+
import { readdirSync as readdirSync20, readFileSync as readFileSync56, statSync as statSync12 } from "fs";
|
|
32499
32605
|
import { join as join87 } from "path";
|
|
32500
32606
|
function findPortFile(roamDir) {
|
|
32501
32607
|
let entries;
|
|
@@ -32505,9 +32611,9 @@ function findPortFile(roamDir) {
|
|
|
32505
32611
|
return void 0;
|
|
32506
32612
|
}
|
|
32507
32613
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
32508
|
-
const
|
|
32614
|
+
const path83 = join87(roamDir, name);
|
|
32509
32615
|
try {
|
|
32510
|
-
return { path:
|
|
32616
|
+
return { path: path83, mtimeMs: statSync12(path83).mtimeMs };
|
|
32511
32617
|
} catch {
|
|
32512
32618
|
return void 0;
|
|
32513
32619
|
}
|
|
@@ -32521,7 +32627,7 @@ function postRoamActivity(app, event) {
|
|
|
32521
32627
|
if (!portFile) return;
|
|
32522
32628
|
let port;
|
|
32523
32629
|
try {
|
|
32524
|
-
port =
|
|
32630
|
+
port = readFileSync56(portFile, "utf8").trim();
|
|
32525
32631
|
} catch {
|
|
32526
32632
|
return;
|
|
32527
32633
|
}
|
|
@@ -32743,11 +32849,11 @@ function findLinkIndex() {
|
|
|
32743
32849
|
function parseLinkArgs() {
|
|
32744
32850
|
const idx = findLinkIndex();
|
|
32745
32851
|
if (idx === -1) return null;
|
|
32746
|
-
const
|
|
32852
|
+
const path83 = process.argv[idx + 1];
|
|
32747
32853
|
const rest = process.argv.slice(idx + 2);
|
|
32748
32854
|
const { value: prefix2 } = extractOption(rest, "--prefix");
|
|
32749
32855
|
if (!prefix2) return null;
|
|
32750
|
-
return { path:
|
|
32856
|
+
return { path: path83, prefix: prefix2 };
|
|
32751
32857
|
}
|
|
32752
32858
|
function hasDuplicateLink(runList, linkPath) {
|
|
32753
32859
|
return runList.some(
|
|
@@ -32775,7 +32881,7 @@ function link2() {
|
|
|
32775
32881
|
}
|
|
32776
32882
|
|
|
32777
32883
|
// src/commands/run/remove.ts
|
|
32778
|
-
import { existsSync as
|
|
32884
|
+
import { existsSync as existsSync76, unlinkSync as unlinkSync21 } from "fs";
|
|
32779
32885
|
import { join as join89 } from "path";
|
|
32780
32886
|
function findRemoveIndex() {
|
|
32781
32887
|
const idx = process.argv.indexOf("remove");
|
|
@@ -32792,7 +32898,7 @@ function parseRemoveName() {
|
|
|
32792
32898
|
}
|
|
32793
32899
|
function deleteCommandFile(name) {
|
|
32794
32900
|
const filePath = join89(".claude", "commands", `${name}.md`);
|
|
32795
|
-
if (
|
|
32901
|
+
if (existsSync76(filePath)) {
|
|
32796
32902
|
unlinkSync21(filePath);
|
|
32797
32903
|
console.log(`Deleted command file: ${filePath}`);
|
|
32798
32904
|
}
|
|
@@ -32837,10 +32943,10 @@ function registerRun(program2) {
|
|
|
32837
32943
|
|
|
32838
32944
|
// src/commands/screenshot/index.ts
|
|
32839
32945
|
import { execSync as execSync60 } from "child_process";
|
|
32840
|
-
import { existsSync as
|
|
32946
|
+
import { existsSync as existsSync77, mkdirSync as mkdirSync32, unlinkSync as unlinkSync22, writeFileSync as writeFileSync47 } from "fs";
|
|
32841
32947
|
import { tmpdir as tmpdir8 } from "os";
|
|
32842
32948
|
import { join as join90, resolve as resolve21 } from "path";
|
|
32843
|
-
import
|
|
32949
|
+
import chalk223 from "chalk";
|
|
32844
32950
|
|
|
32845
32951
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
32846
32952
|
var captureWindowPs1 = `
|
|
@@ -32969,7 +33075,7 @@ Write-Output $OutputPath
|
|
|
32969
33075
|
|
|
32970
33076
|
// src/commands/screenshot/index.ts
|
|
32971
33077
|
function buildOutputPath(outputDir, processName) {
|
|
32972
|
-
if (!
|
|
33078
|
+
if (!existsSync77(outputDir)) {
|
|
32973
33079
|
mkdirSync32(outputDir, { recursive: true });
|
|
32974
33080
|
}
|
|
32975
33081
|
const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
@@ -32991,13 +33097,13 @@ function screenshot(processName) {
|
|
|
32991
33097
|
const config = loadConfig();
|
|
32992
33098
|
const outputDir = resolve21(config.screenshot.outputDir);
|
|
32993
33099
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
32994
|
-
console.log(
|
|
33100
|
+
console.log(chalk223.gray(`Capturing window for process "${processName}" ...`));
|
|
32995
33101
|
try {
|
|
32996
33102
|
runPowerShellScript(processName, outputPath);
|
|
32997
|
-
console.log(
|
|
33103
|
+
console.log(chalk223.green(`Screenshot saved: ${outputPath}`));
|
|
32998
33104
|
} catch (error) {
|
|
32999
33105
|
const msg = error instanceof Error ? error.message : String(error);
|
|
33000
|
-
console.error(
|
|
33106
|
+
console.error(chalk223.red(`Failed to capture screenshot: ${msg}`));
|
|
33001
33107
|
process.exit(1);
|
|
33002
33108
|
}
|
|
33003
33109
|
}
|
|
@@ -33053,11 +33159,11 @@ function applyLine(result, pending, line) {
|
|
|
33053
33159
|
}
|
|
33054
33160
|
|
|
33055
33161
|
// src/commands/sessions/daemon/readDaemonPidFile.ts
|
|
33056
|
-
import { readFileSync as
|
|
33162
|
+
import { readFileSync as readFileSync57 } from "fs";
|
|
33057
33163
|
function readDaemonPidFile() {
|
|
33058
33164
|
try {
|
|
33059
33165
|
const pid = Number.parseInt(
|
|
33060
|
-
|
|
33166
|
+
readFileSync57(daemonPaths.pid, "utf8").trim(),
|
|
33061
33167
|
10
|
|
33062
33168
|
);
|
|
33063
33169
|
return Number.isInteger(pid) ? pid : void 0;
|
|
@@ -33314,12 +33420,12 @@ function toSessionRunInfo({
|
|
|
33314
33420
|
}
|
|
33315
33421
|
|
|
33316
33422
|
// src/commands/sessions/daemon/worktree/joinRefusal.ts
|
|
33317
|
-
import { existsSync as
|
|
33423
|
+
import { existsSync as existsSync78 } from "fs";
|
|
33318
33424
|
function joinRefusal(session) {
|
|
33319
33425
|
if (session.commandType === "run") return "a server run has no agent stream";
|
|
33320
33426
|
if (session.closing === true) return "the session is closing";
|
|
33321
33427
|
if (!session.cwd) return "the session has no working directory";
|
|
33322
|
-
if (!
|
|
33428
|
+
if (!existsSync78(session.cwd))
|
|
33323
33429
|
return "the session's workspace no longer exists";
|
|
33324
33430
|
return void 0;
|
|
33325
33431
|
}
|
|
@@ -33483,27 +33589,27 @@ function sessionBase(id, status3) {
|
|
|
33483
33589
|
}
|
|
33484
33590
|
|
|
33485
33591
|
// src/commands/sessions/daemon/spawnPty.ts
|
|
33486
|
-
import { existsSync as
|
|
33592
|
+
import { existsSync as existsSync80 } from "fs";
|
|
33487
33593
|
import * as pty from "node-pty";
|
|
33488
33594
|
|
|
33489
33595
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
33490
|
-
import { chmodSync, existsSync as
|
|
33596
|
+
import { chmodSync, existsSync as existsSync79, statSync as statSync13 } from "fs";
|
|
33491
33597
|
import { createRequire as createRequire3 } from "module";
|
|
33492
|
-
import
|
|
33598
|
+
import path78 from "path";
|
|
33493
33599
|
var require4 = createRequire3(import.meta.url);
|
|
33494
33600
|
var ensured = false;
|
|
33495
33601
|
function ensureSpawnHelperExecutable() {
|
|
33496
33602
|
if (ensured || process.platform !== "darwin") return;
|
|
33497
33603
|
ensured = true;
|
|
33498
|
-
const ptyRoot =
|
|
33499
|
-
const helper =
|
|
33604
|
+
const ptyRoot = path78.join(path78.dirname(require4.resolve("node-pty")), "..");
|
|
33605
|
+
const helper = path78.join(
|
|
33500
33606
|
ptyRoot,
|
|
33501
33607
|
"prebuilds",
|
|
33502
33608
|
`${process.platform}-${process.arch}`,
|
|
33503
33609
|
"spawn-helper"
|
|
33504
33610
|
);
|
|
33505
|
-
if (!
|
|
33506
|
-
const mode =
|
|
33611
|
+
if (!existsSync79(helper)) return;
|
|
33612
|
+
const mode = statSync13(helper).mode;
|
|
33507
33613
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
33508
33614
|
}
|
|
33509
33615
|
|
|
@@ -33538,7 +33644,7 @@ function spawnPty(args, cwd, sessionId, extraEnv) {
|
|
|
33538
33644
|
});
|
|
33539
33645
|
}
|
|
33540
33646
|
function refuseMissingCwd(cwd, sessionId) {
|
|
33541
|
-
if (!cwd ||
|
|
33647
|
+
if (!cwd || existsSync80(cwd)) return;
|
|
33542
33648
|
daemonLog(
|
|
33543
33649
|
`${sessionId ? `session ${sessionId}` : "pty"} not spawned: working directory ${cwd} no longer exists`
|
|
33544
33650
|
);
|
|
@@ -33617,12 +33723,12 @@ function serverRunMeta(runName, cwd) {
|
|
|
33617
33723
|
|
|
33618
33724
|
// src/commands/sessions/daemon/readDesignSystemPrompt.ts
|
|
33619
33725
|
import * as fs49 from "fs";
|
|
33620
|
-
import * as
|
|
33726
|
+
import * as path79 from "path";
|
|
33621
33727
|
import { fileURLToPath as fileURLToPath10 } from "url";
|
|
33622
33728
|
var __filename5 = fileURLToPath10(import.meta.url);
|
|
33623
|
-
var __dirname7 =
|
|
33729
|
+
var __dirname7 = path79.dirname(__filename5);
|
|
33624
33730
|
function readDesignSystemPrompt() {
|
|
33625
|
-
const promptPath =
|
|
33731
|
+
const promptPath = path79.join(
|
|
33626
33732
|
__dirname7,
|
|
33627
33733
|
"..",
|
|
33628
33734
|
"claude",
|
|
@@ -33720,15 +33826,15 @@ function setStatus2(session, newStatus) {
|
|
|
33720
33826
|
}
|
|
33721
33827
|
|
|
33722
33828
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
33723
|
-
import { existsSync as
|
|
33829
|
+
import { existsSync as existsSync82 } from "fs";
|
|
33724
33830
|
import { basename as basename22 } from "path";
|
|
33725
33831
|
|
|
33726
33832
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
33727
|
-
import { existsSync as
|
|
33833
|
+
import { existsSync as existsSync81 } from "fs";
|
|
33728
33834
|
import { join as join93 } from "path";
|
|
33729
33835
|
|
|
33730
33836
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
33731
|
-
import { statSync as
|
|
33837
|
+
import { statSync as statSync14 } from "fs";
|
|
33732
33838
|
import { rm as rm2 } from "fs/promises";
|
|
33733
33839
|
import { join as join92 } from "path";
|
|
33734
33840
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
@@ -33758,7 +33864,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
33758
33864
|
return { removed: true };
|
|
33759
33865
|
}
|
|
33760
33866
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
33761
|
-
return
|
|
33867
|
+
return statSync14(join92(worktreePath, ".git"), {
|
|
33762
33868
|
throwIfNoEntry: false
|
|
33763
33869
|
})?.isDirectory() === true;
|
|
33764
33870
|
}
|
|
@@ -33794,7 +33900,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
33794
33900
|
);
|
|
33795
33901
|
}
|
|
33796
33902
|
function strandedReason(worktreePath, cause) {
|
|
33797
|
-
if (!
|
|
33903
|
+
if (!existsSync81(join93(worktreePath, ".git")))
|
|
33798
33904
|
return "its .git link is already gone";
|
|
33799
33905
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
33800
33906
|
return "git no longer recognises it as a working tree";
|
|
@@ -33846,7 +33952,7 @@ function reason3(error) {
|
|
|
33846
33952
|
|
|
33847
33953
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
33848
33954
|
async function reapWorktree(worktreePath, force = false) {
|
|
33849
|
-
if (!
|
|
33955
|
+
if (!existsSync82(worktreePath)) {
|
|
33850
33956
|
forgetWorktree(worktreePath);
|
|
33851
33957
|
daemonLog(
|
|
33852
33958
|
`worktree ${worktreePath} already gone; its record was forgotten`
|
|
@@ -33871,7 +33977,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
33871
33977
|
}
|
|
33872
33978
|
function owningClone(worktreePath) {
|
|
33873
33979
|
const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
|
|
33874
|
-
if (recorded &&
|
|
33980
|
+
if (recorded && existsSync82(recorded)) return recorded;
|
|
33875
33981
|
const detected = mainWorktree(worktreePath);
|
|
33876
33982
|
if (detected) return detected;
|
|
33877
33983
|
daemonLog(
|
|
@@ -34002,12 +34108,12 @@ function closeGateApplies(sessions, session) {
|
|
|
34002
34108
|
}
|
|
34003
34109
|
|
|
34004
34110
|
// src/commands/sessions/daemon/worktree/watchGitState.ts
|
|
34005
|
-
import { existsSync as
|
|
34111
|
+
import { existsSync as existsSync83, watch } from "fs";
|
|
34006
34112
|
var DEBOUNCE_MS = 500;
|
|
34007
34113
|
var POLL_MS = 3e4;
|
|
34008
34114
|
function watchGitState(cwd, onChange) {
|
|
34009
34115
|
const common = gitCommonDir(cwd);
|
|
34010
|
-
if (!common || !
|
|
34116
|
+
if (!common || !existsSync83(common)) return void 0;
|
|
34011
34117
|
const watchers = [
|
|
34012
34118
|
watchGitDir(common, onChange),
|
|
34013
34119
|
pollGitState(cwd, onChange)
|
|
@@ -34484,10 +34590,10 @@ function emitSessionOutput(session, clients, data) {
|
|
|
34484
34590
|
}
|
|
34485
34591
|
|
|
34486
34592
|
// src/commands/sessions/daemon/exitReason.ts
|
|
34487
|
-
import { existsSync as
|
|
34593
|
+
import { existsSync as existsSync84 } from "fs";
|
|
34488
34594
|
import { resolve as resolve22 } from "path";
|
|
34489
34595
|
function exitDetail(session) {
|
|
34490
|
-
if (session.cwd && !
|
|
34596
|
+
if (session.cwd && !existsSync84(session.cwd))
|
|
34491
34597
|
return `working directory ${session.cwd} no longer exists`;
|
|
34492
34598
|
return missingRunConfigCwd(session);
|
|
34493
34599
|
}
|
|
@@ -34501,7 +34607,7 @@ function missingRunConfigCwd(session) {
|
|
|
34501
34607
|
const config = resolveRunConfig(session.runName, dir);
|
|
34502
34608
|
if (!config?.cwd) return void 0;
|
|
34503
34609
|
const configured = resolve22(runConfigBaseDirFrom(dir), config.cwd);
|
|
34504
|
-
if (
|
|
34610
|
+
if (existsSync84(configured)) return void 0;
|
|
34505
34611
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
34506
34612
|
}
|
|
34507
34613
|
|
|
@@ -34542,7 +34648,7 @@ function handleFailedResume(session, exitCode, onStatusChange) {
|
|
|
34542
34648
|
}
|
|
34543
34649
|
|
|
34544
34650
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
34545
|
-
import { existsSync as
|
|
34651
|
+
import { existsSync as existsSync85, mkdirSync as mkdirSync33, watch as watch2 } from "fs";
|
|
34546
34652
|
import { dirname as dirname39 } from "path";
|
|
34547
34653
|
|
|
34548
34654
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
@@ -34604,8 +34710,8 @@ async function seedRunningMsFromUsage(session, notify2) {
|
|
|
34604
34710
|
var DEBOUNCE_MS2 = 50;
|
|
34605
34711
|
function watchActivity(session, notify2, onClaudeSessionId) {
|
|
34606
34712
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
34607
|
-
const
|
|
34608
|
-
const dir = dirname39(
|
|
34713
|
+
const path83 = activityPath(session.id);
|
|
34714
|
+
const dir = dirname39(path83);
|
|
34609
34715
|
try {
|
|
34610
34716
|
mkdirSync33(dir, { recursive: true });
|
|
34611
34717
|
} catch {
|
|
@@ -34615,7 +34721,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
34615
34721
|
let timer = null;
|
|
34616
34722
|
const read2 = () => {
|
|
34617
34723
|
timer = null;
|
|
34618
|
-
const activity2 = readActivity(
|
|
34724
|
+
const activity2 = readActivity(path83);
|
|
34619
34725
|
if (!activity2) return;
|
|
34620
34726
|
applyActivityToSession(session, activity2);
|
|
34621
34727
|
if (activity2.claudeSessionId) onClaudeSessionId?.(session);
|
|
@@ -34624,11 +34730,11 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
34624
34730
|
notify2();
|
|
34625
34731
|
};
|
|
34626
34732
|
session.activityWatcher = watch2(dir, (_event, filename) => {
|
|
34627
|
-
if (filename && !
|
|
34733
|
+
if (filename && !path83.endsWith(filename)) return;
|
|
34628
34734
|
if (timer) clearTimeout(timer);
|
|
34629
34735
|
timer = setTimeout(read2, DEBOUNCE_MS2);
|
|
34630
34736
|
});
|
|
34631
|
-
if (
|
|
34737
|
+
if (existsSync85(path83)) read2();
|
|
34632
34738
|
}
|
|
34633
34739
|
function refreshActivity(session) {
|
|
34634
34740
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -34771,12 +34877,12 @@ import { watch as watch3 } from "fs";
|
|
|
34771
34877
|
|
|
34772
34878
|
// src/commands/sessions/shared/findTranscriptPathSync.ts
|
|
34773
34879
|
import * as fs51 from "fs";
|
|
34774
|
-
import * as
|
|
34880
|
+
import * as path80 from "path";
|
|
34775
34881
|
function projectDirForCwd(cwd) {
|
|
34776
|
-
return
|
|
34882
|
+
return path80.join(claudeProjectsRoot(), projectSlug(cwd));
|
|
34777
34883
|
}
|
|
34778
34884
|
function transcriptPathFor(cwd, claudeSessionId) {
|
|
34779
|
-
return
|
|
34885
|
+
return path80.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
|
|
34780
34886
|
}
|
|
34781
34887
|
function findTranscriptPathSync(cwd, claudeSessionId) {
|
|
34782
34888
|
const direct = transcriptPathFor(cwd, claudeSessionId);
|
|
@@ -34790,8 +34896,8 @@ function findTranscriptPathSync(cwd, claudeSessionId) {
|
|
|
34790
34896
|
}
|
|
34791
34897
|
for (const file of files) {
|
|
34792
34898
|
if (!file.endsWith(".jsonl")) continue;
|
|
34793
|
-
if (headContainsSessionId(
|
|
34794
|
-
return
|
|
34899
|
+
if (headContainsSessionId(path80.join(dir, file), claudeSessionId))
|
|
34900
|
+
return path80.join(dir, file);
|
|
34795
34901
|
}
|
|
34796
34902
|
return null;
|
|
34797
34903
|
}
|
|
@@ -35965,9 +36071,9 @@ function tempRoots() {
|
|
|
35965
36071
|
}
|
|
35966
36072
|
return [...roots];
|
|
35967
36073
|
}
|
|
35968
|
-
function underTempRoot(
|
|
36074
|
+
function underTempRoot(path83) {
|
|
35969
36075
|
return tempRoots().some(
|
|
35970
|
-
(root) =>
|
|
36076
|
+
(root) => path83.startsWith(root.endsWith(sep2) ? root : root + sep2)
|
|
35971
36077
|
);
|
|
35972
36078
|
}
|
|
35973
36079
|
|
|
@@ -36279,7 +36385,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
36279
36385
|
}
|
|
36280
36386
|
|
|
36281
36387
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
36282
|
-
import { existsSync as
|
|
36388
|
+
import { existsSync as existsSync88 } from "fs";
|
|
36283
36389
|
import { basename as basename24 } from "path";
|
|
36284
36390
|
|
|
36285
36391
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
@@ -36334,18 +36440,18 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
36334
36440
|
}
|
|
36335
36441
|
|
|
36336
36442
|
// src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
|
|
36337
|
-
import { existsSync as
|
|
36443
|
+
import { existsSync as existsSync87 } from "fs";
|
|
36338
36444
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
36339
|
-
if (!
|
|
36340
|
-
for (const { path:
|
|
36445
|
+
if (!existsSync87(clone)) {
|
|
36446
|
+
for (const { path: path83 } of paths) forgetWorktree(path83);
|
|
36341
36447
|
daemonLog(
|
|
36342
36448
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
36343
36449
|
);
|
|
36344
36450
|
return;
|
|
36345
36451
|
}
|
|
36346
36452
|
await pruneBookkeeping2(clone);
|
|
36347
|
-
for (const { path:
|
|
36348
|
-
if (await reclaimBranch(clone, branch2)) forgetWorktree(
|
|
36453
|
+
for (const { path: path83, branch: branch2 } of paths)
|
|
36454
|
+
if (await reclaimBranch(clone, branch2)) forgetWorktree(path83);
|
|
36349
36455
|
}
|
|
36350
36456
|
async function pruneBookkeeping2(clone) {
|
|
36351
36457
|
try {
|
|
@@ -36372,37 +36478,37 @@ async function reclaimBranch(clone, branch2) {
|
|
|
36372
36478
|
}
|
|
36373
36479
|
|
|
36374
36480
|
// src/commands/sessions/daemon/worktree/logVanishedTree.ts
|
|
36375
|
-
function logVanishedTree(sessions,
|
|
36481
|
+
function logVanishedTree(sessions, path83) {
|
|
36376
36482
|
const claimants = [...sessions.values()].filter(
|
|
36377
|
-
(s) => s.cwd ===
|
|
36483
|
+
(s) => s.cwd === path83 || s.worktree?.path === path83
|
|
36378
36484
|
);
|
|
36379
36485
|
if (claimants.length === 0) {
|
|
36380
|
-
daemonLog(`worktree ${
|
|
36486
|
+
daemonLog(`worktree ${path83} gone from disk and unclaimed; reclaiming it`);
|
|
36381
36487
|
return;
|
|
36382
36488
|
}
|
|
36383
36489
|
for (const s of claimants)
|
|
36384
36490
|
daemonLog(
|
|
36385
|
-
`session ${s.id} ("${s.name}") claims worktree ${
|
|
36491
|
+
`session ${s.id} ("${s.name}") claims worktree ${path83}, which is gone from disk; reclaiming it`
|
|
36386
36492
|
);
|
|
36387
36493
|
}
|
|
36388
36494
|
|
|
36389
36495
|
// src/commands/sessions/daemon/worktree/describeHeldWork.ts
|
|
36390
36496
|
var MAX_ITEMS = 20;
|
|
36391
|
-
async function describeHeldWork(
|
|
36392
|
-
if (reason4.startsWith("uncommitted")) return await changedFiles(
|
|
36393
|
-
if (reason4.startsWith("unpushed")) return await unpushedCommits(
|
|
36497
|
+
async function describeHeldWork(path83, reason4) {
|
|
36498
|
+
if (reason4.startsWith("uncommitted")) return await changedFiles(path83);
|
|
36499
|
+
if (reason4.startsWith("unpushed")) return await unpushedCommits(path83, reason4);
|
|
36394
36500
|
return { summary: reason4, items: [] };
|
|
36395
36501
|
}
|
|
36396
|
-
async function changedFiles(
|
|
36397
|
-
const status3 = await gitResult(
|
|
36502
|
+
async function changedFiles(path83) {
|
|
36503
|
+
const status3 = await gitResult(path83, ["status", "--porcelain"]);
|
|
36398
36504
|
const lines2 = status3.ok ? nonEmptyLines(status3.out) : [];
|
|
36399
36505
|
return {
|
|
36400
36506
|
summary: `${lines2.length} uncommitted ${lines2.length === 1 ? "file" : "files"}`,
|
|
36401
36507
|
items: capped(lines2)
|
|
36402
36508
|
};
|
|
36403
36509
|
}
|
|
36404
|
-
async function unpushedCommits(
|
|
36405
|
-
const log2 = await gitResult(
|
|
36510
|
+
async function unpushedCommits(path83, reason4) {
|
|
36511
|
+
const log2 = await gitResult(path83, ["log", "--oneline", "@{upstream}..HEAD"]);
|
|
36406
36512
|
if (!log2.ok) return { summary: reason4, items: [] };
|
|
36407
36513
|
const lines2 = nonEmptyLines(log2.out);
|
|
36408
36514
|
return {
|
|
@@ -36494,24 +36600,24 @@ function reconcileWorktreesOnRestore(sessions, spawnWith, notify2) {
|
|
|
36494
36600
|
async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
36495
36601
|
const accounted = accountedTrees(sessions);
|
|
36496
36602
|
const vanished = /* @__PURE__ */ new Map();
|
|
36497
|
-
for (const { path:
|
|
36498
|
-
if (underTempRoot(
|
|
36499
|
-
forgetWorktree(
|
|
36603
|
+
for (const { path: path83, clone } of readWorktreeRegistry()) {
|
|
36604
|
+
if (underTempRoot(path83)) {
|
|
36605
|
+
forgetWorktree(path83);
|
|
36500
36606
|
daemonLog(
|
|
36501
|
-
`worktree ${
|
|
36607
|
+
`worktree ${path83} lies outside any project root; pruned from the registry rather than recovered`
|
|
36502
36608
|
);
|
|
36503
36609
|
continue;
|
|
36504
36610
|
}
|
|
36505
|
-
if (!
|
|
36506
|
-
logVanishedTree(sessions,
|
|
36611
|
+
if (!existsSync88(path83)) {
|
|
36612
|
+
logVanishedTree(sessions, path83);
|
|
36507
36613
|
vanished.set(clone, [
|
|
36508
36614
|
...vanished.get(clone) ?? [],
|
|
36509
|
-
{ path:
|
|
36615
|
+
{ path: path83, branch: basename24(path83) }
|
|
36510
36616
|
]);
|
|
36511
36617
|
continue;
|
|
36512
36618
|
}
|
|
36513
|
-
if (accounted.has(
|
|
36514
|
-
await recoverOrphan(sessions, spawnWith, { path:
|
|
36619
|
+
if (accounted.has(path83)) continue;
|
|
36620
|
+
await recoverOrphan(sessions, spawnWith, { path: path83, clone }, notify2);
|
|
36515
36621
|
}
|
|
36516
36622
|
for (const [clone, paths] of vanished)
|
|
36517
36623
|
await reclaimVanishedWorktrees(clone, paths);
|
|
@@ -37119,14 +37225,14 @@ async function defaultConnect() {
|
|
|
37119
37225
|
}
|
|
37120
37226
|
|
|
37121
37227
|
// src/commands/sessions/daemon/hasPersistedWindowsSessions.ts
|
|
37122
|
-
import { existsSync as
|
|
37228
|
+
import { existsSync as existsSync89, readFileSync as readFileSync59 } from "fs";
|
|
37123
37229
|
import { posix as posix3 } from "path";
|
|
37124
37230
|
function hasPersistedWindowsSessions() {
|
|
37125
37231
|
const sessionsFile = windowsSessionsFileFromWsl();
|
|
37126
37232
|
if (!sessionsFile) return false;
|
|
37127
37233
|
try {
|
|
37128
|
-
if (!
|
|
37129
|
-
const data = JSON.parse(
|
|
37234
|
+
if (!existsSync89(sessionsFile)) return false;
|
|
37235
|
+
const data = JSON.parse(readFileSync59(sessionsFile, "utf8"));
|
|
37130
37236
|
return Array.isArray(data) && data.length > 0;
|
|
37131
37237
|
} catch (error) {
|
|
37132
37238
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
@@ -37860,7 +37966,7 @@ function setAutoAdvance(sessions, id, enabled) {
|
|
|
37860
37966
|
}
|
|
37861
37967
|
|
|
37862
37968
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
37863
|
-
import { existsSync as
|
|
37969
|
+
import { existsSync as existsSync92 } from "fs";
|
|
37864
37970
|
|
|
37865
37971
|
// src/commands/sessions/daemon/resumeSession.ts
|
|
37866
37972
|
function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
@@ -37891,10 +37997,10 @@ function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
|
37891
37997
|
}
|
|
37892
37998
|
|
|
37893
37999
|
// src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
|
|
37894
|
-
import { existsSync as
|
|
38000
|
+
import { existsSync as existsSync91 } from "fs";
|
|
37895
38001
|
|
|
37896
38002
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
37897
|
-
import { copyFileSync as copyFileSync7, existsSync as
|
|
38003
|
+
import { copyFileSync as copyFileSync7, existsSync as existsSync90, mkdirSync as mkdirSync35 } from "fs";
|
|
37898
38004
|
import { join as join95 } from "path";
|
|
37899
38005
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
37900
38006
|
const dir = projectDirForCwd(toCwd);
|
|
@@ -37905,7 +38011,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
37905
38011
|
return;
|
|
37906
38012
|
}
|
|
37907
38013
|
const dest = join95(dir, `${claudeSessionId}.jsonl`);
|
|
37908
|
-
if (
|
|
38014
|
+
if (existsSync90(dest)) {
|
|
37909
38015
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
37910
38016
|
return;
|
|
37911
38017
|
}
|
|
@@ -37956,7 +38062,7 @@ function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name, harness
|
|
|
37956
38062
|
}
|
|
37957
38063
|
function cloneForReapedTree(missingCwd) {
|
|
37958
38064
|
const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
|
|
37959
|
-
if (!clone || !
|
|
38065
|
+
if (!clone || !existsSync91(clone))
|
|
37960
38066
|
throw new Error(
|
|
37961
38067
|
`working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
|
|
37962
38068
|
);
|
|
@@ -37965,7 +38071,7 @@ function cloneForReapedTree(missingCwd) {
|
|
|
37965
38071
|
|
|
37966
38072
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
37967
38073
|
function resumeInTree(ctx, sessionId, cwd, name, harness) {
|
|
37968
|
-
if (!
|
|
38074
|
+
if (!existsSync92(cwd))
|
|
37969
38075
|
return resumeInReplacementTree(ctx, sessionId, cwd, name, harness);
|
|
37970
38076
|
const id = ctx.spawnWith(
|
|
37971
38077
|
(sid) => resumeSession(sid, sessionId, cwd, name, void 0, harness)
|
|
@@ -38232,12 +38338,12 @@ function handleSetStatus(client, m, d) {
|
|
|
38232
38338
|
import * as fs54 from "fs";
|
|
38233
38339
|
|
|
38234
38340
|
// src/commands/sessions/shared/codex/findCodexRolloutPath.ts
|
|
38235
|
-
import * as
|
|
38341
|
+
import * as path81 from "path";
|
|
38236
38342
|
async function findCodexRolloutPath(sessionId) {
|
|
38237
38343
|
if (!sessionId) return null;
|
|
38238
38344
|
const paths = await discoverCodexRolloutPaths();
|
|
38239
38345
|
const suffix = `-${sessionId}.jsonl`;
|
|
38240
|
-
return paths.find((file) =>
|
|
38346
|
+
return paths.find((file) => path81.basename(file).endsWith(suffix)) ?? null;
|
|
38241
38347
|
}
|
|
38242
38348
|
|
|
38243
38349
|
// src/commands/sessions/shared/codex/codexToolTarget.ts
|
|
@@ -38545,7 +38651,7 @@ function handleConnection(socket, manager) {
|
|
|
38545
38651
|
import { unlinkSync as unlinkSync23, writeFileSync as writeFileSync48 } from "fs";
|
|
38546
38652
|
|
|
38547
38653
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
38548
|
-
import { readFileSync as
|
|
38654
|
+
import { readFileSync as readFileSync60 } from "fs";
|
|
38549
38655
|
var WATCHDOG_INTERVAL_MS = 5e3;
|
|
38550
38656
|
function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
38551
38657
|
const timer = setInterval(() => {
|
|
@@ -38556,7 +38662,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
|
38556
38662
|
}
|
|
38557
38663
|
function ownsPidFile() {
|
|
38558
38664
|
try {
|
|
38559
|
-
return
|
|
38665
|
+
return readFileSync60(daemonPaths.pid, "utf8").trim() === String(process.pid);
|
|
38560
38666
|
} catch {
|
|
38561
38667
|
return false;
|
|
38562
38668
|
}
|
|
@@ -38806,7 +38912,7 @@ function registerSetStatusCommand(cmd) {
|
|
|
38806
38912
|
|
|
38807
38913
|
// src/commands/sessions/summarise/index.ts
|
|
38808
38914
|
import * as fs56 from "fs";
|
|
38809
|
-
import
|
|
38915
|
+
import chalk224 from "chalk";
|
|
38810
38916
|
|
|
38811
38917
|
// src/commands/sessions/summarise/shared.ts
|
|
38812
38918
|
import * as fs55 from "fs";
|
|
@@ -38865,22 +38971,22 @@ ${firstMessage}`);
|
|
|
38865
38971
|
async function summarise2(options2) {
|
|
38866
38972
|
const files = await discoverSessionFiles();
|
|
38867
38973
|
if (files.length === 0) {
|
|
38868
|
-
console.log(
|
|
38974
|
+
console.log(chalk224.yellow("No sessions found."));
|
|
38869
38975
|
return;
|
|
38870
38976
|
}
|
|
38871
38977
|
const toProcess = selectCandidates(files, options2);
|
|
38872
38978
|
if (toProcess.length === 0) {
|
|
38873
|
-
console.log(
|
|
38979
|
+
console.log(chalk224.green("All sessions already summarised."));
|
|
38874
38980
|
return;
|
|
38875
38981
|
}
|
|
38876
38982
|
console.log(
|
|
38877
|
-
|
|
38983
|
+
chalk224.cyan(
|
|
38878
38984
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
38879
38985
|
)
|
|
38880
38986
|
);
|
|
38881
38987
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
38882
38988
|
console.log(
|
|
38883
|
-
|
|
38989
|
+
chalk224.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk224.yellow(`, ${failed2} skipped`) : "")
|
|
38884
38990
|
);
|
|
38885
38991
|
}
|
|
38886
38992
|
function selectCandidates(files, options2) {
|
|
@@ -38900,16 +39006,16 @@ function processSessions(files) {
|
|
|
38900
39006
|
let failed2 = 0;
|
|
38901
39007
|
for (let i = 0; i < files.length; i++) {
|
|
38902
39008
|
const file = files[i];
|
|
38903
|
-
process.stdout.write(
|
|
39009
|
+
process.stdout.write(chalk224.dim(` [${i + 1}/${files.length}] `));
|
|
38904
39010
|
const summary = summariseSession(file);
|
|
38905
39011
|
if (summary) {
|
|
38906
39012
|
writeSummary(file, summary);
|
|
38907
39013
|
succeeded++;
|
|
38908
|
-
process.stdout.write(`${
|
|
39014
|
+
process.stdout.write(`${chalk224.green("\u2713")} ${summary}
|
|
38909
39015
|
`);
|
|
38910
39016
|
} else {
|
|
38911
39017
|
failed2++;
|
|
38912
|
-
process.stdout.write(` ${
|
|
39018
|
+
process.stdout.write(` ${chalk224.yellow("skip")}
|
|
38913
39019
|
`);
|
|
38914
39020
|
}
|
|
38915
39021
|
}
|
|
@@ -38930,7 +39036,7 @@ function registerSessions(program2) {
|
|
|
38930
39036
|
}
|
|
38931
39037
|
|
|
38932
39038
|
// src/commands/statusLine.ts
|
|
38933
|
-
import
|
|
39039
|
+
import chalk226 from "chalk";
|
|
38934
39040
|
|
|
38935
39041
|
// src/shared/contextLevel.ts
|
|
38936
39042
|
function contextLevel(pct) {
|
|
@@ -38940,7 +39046,7 @@ function contextLevel(pct) {
|
|
|
38940
39046
|
}
|
|
38941
39047
|
|
|
38942
39048
|
// src/commands/buildLimitsSegment.ts
|
|
38943
|
-
import
|
|
39049
|
+
import chalk225 from "chalk";
|
|
38944
39050
|
|
|
38945
39051
|
// src/shared/rateLimitLevel.ts
|
|
38946
39052
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -38978,9 +39084,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
38978
39084
|
|
|
38979
39085
|
// src/commands/buildLimitsSegment.ts
|
|
38980
39086
|
var LEVEL_COLOR = {
|
|
38981
|
-
ok:
|
|
38982
|
-
warn:
|
|
38983
|
-
over:
|
|
39087
|
+
ok: chalk225.green,
|
|
39088
|
+
warn: chalk225.yellow,
|
|
39089
|
+
over: chalk225.red
|
|
38984
39090
|
};
|
|
38985
39091
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
38986
39092
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -39011,13 +39117,13 @@ function buildLimitsSegment(rateLimits) {
|
|
|
39011
39117
|
}
|
|
39012
39118
|
|
|
39013
39119
|
// src/commands/readGitBranch.ts
|
|
39014
|
-
import { readFileSync as
|
|
39120
|
+
import { readFileSync as readFileSync62, statSync as statSync16 } from "fs";
|
|
39015
39121
|
import { isAbsolute as isAbsolute5, join as join96, resolve as resolve23 } from "path";
|
|
39016
39122
|
function resolveGitDir(cwd) {
|
|
39017
39123
|
const dotGit = join96(cwd, ".git");
|
|
39018
39124
|
let stat4;
|
|
39019
39125
|
try {
|
|
39020
|
-
stat4 =
|
|
39126
|
+
stat4 = statSync16(dotGit);
|
|
39021
39127
|
} catch {
|
|
39022
39128
|
return null;
|
|
39023
39129
|
}
|
|
@@ -39026,7 +39132,7 @@ function resolveGitDir(cwd) {
|
|
|
39026
39132
|
}
|
|
39027
39133
|
let contents;
|
|
39028
39134
|
try {
|
|
39029
|
-
contents =
|
|
39135
|
+
contents = readFileSync62(dotGit, "utf8");
|
|
39030
39136
|
} catch {
|
|
39031
39137
|
return null;
|
|
39032
39138
|
}
|
|
@@ -39044,7 +39150,7 @@ function readGitBranch(cwd) {
|
|
|
39044
39150
|
}
|
|
39045
39151
|
let head;
|
|
39046
39152
|
try {
|
|
39047
|
-
head =
|
|
39153
|
+
head = readFileSync62(join96(gitDir, "HEAD"), "utf8");
|
|
39048
39154
|
} catch {
|
|
39049
39155
|
return null;
|
|
39050
39156
|
}
|
|
@@ -39076,7 +39182,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
39076
39182
|
}
|
|
39077
39183
|
|
|
39078
39184
|
// src/commands/statusLine.ts
|
|
39079
|
-
|
|
39185
|
+
chalk226.level = 3;
|
|
39080
39186
|
function formatNumber(num) {
|
|
39081
39187
|
return num.toLocaleString("en-US");
|
|
39082
39188
|
}
|
|
@@ -39084,9 +39190,9 @@ function colorizePercent(pct) {
|
|
|
39084
39190
|
const label2 = `${Math.round(pct)}%`;
|
|
39085
39191
|
switch (contextLevel(pct)) {
|
|
39086
39192
|
case "red":
|
|
39087
|
-
return
|
|
39193
|
+
return chalk226.red(label2);
|
|
39088
39194
|
case "yellow":
|
|
39089
|
-
return
|
|
39195
|
+
return chalk226.yellow(label2);
|
|
39090
39196
|
default:
|
|
39091
39197
|
return label2;
|
|
39092
39198
|
}
|
|
@@ -39099,7 +39205,7 @@ async function statusLine() {
|
|
|
39099
39205
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
39100
39206
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
39101
39207
|
const branch2 = dir ? readGitBranch(toGitCwd(dir)) : null;
|
|
39102
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
39208
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk226.cyan(branch2)} | ` : "";
|
|
39103
39209
|
console.log(
|
|
39104
39210
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
39105
39211
|
);
|
|
@@ -39113,7 +39219,7 @@ async function statusLine() {
|
|
|
39113
39219
|
|
|
39114
39220
|
// src/commands/update.ts
|
|
39115
39221
|
import { execSync as execSync61 } from "child_process";
|
|
39116
|
-
import * as
|
|
39222
|
+
import * as path82 from "path";
|
|
39117
39223
|
|
|
39118
39224
|
// src/commands/restartDaemonAfterUpdate.ts
|
|
39119
39225
|
async function restartDaemonAfterUpdate() {
|
|
@@ -39132,12 +39238,12 @@ async function restartDaemonAfterUpdate() {
|
|
|
39132
39238
|
// src/commands/update.ts
|
|
39133
39239
|
function isGlobalNpmInstall(dir) {
|
|
39134
39240
|
try {
|
|
39135
|
-
const resolved =
|
|
39136
|
-
if (resolved.split(
|
|
39241
|
+
const resolved = path82.resolve(dir);
|
|
39242
|
+
if (resolved.split(path82.sep).includes("node_modules")) {
|
|
39137
39243
|
return true;
|
|
39138
39244
|
}
|
|
39139
39245
|
const globalPrefix = execSync61("npm prefix -g", { stdio: "pipe" }).toString().trim();
|
|
39140
|
-
return resolved.toLowerCase().startsWith(
|
|
39246
|
+
return resolved.toLowerCase().startsWith(path82.resolve(globalPrefix).toLowerCase());
|
|
39141
39247
|
} catch {
|
|
39142
39248
|
return false;
|
|
39143
39249
|
}
|
|
@@ -39169,10 +39275,10 @@ async function update2() {
|
|
|
39169
39275
|
}
|
|
39170
39276
|
|
|
39171
39277
|
// src/reportCliError.ts
|
|
39172
|
-
import
|
|
39278
|
+
import chalk227 from "chalk";
|
|
39173
39279
|
function reportCliError(error) {
|
|
39174
39280
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError) {
|
|
39175
|
-
console.error(
|
|
39281
|
+
console.error(chalk227.red(error.message));
|
|
39176
39282
|
} else {
|
|
39177
39283
|
console.error(error);
|
|
39178
39284
|
}
|
|
@@ -39224,6 +39330,7 @@ registerList(program);
|
|
|
39224
39330
|
registerVerify(program);
|
|
39225
39331
|
registerRefactor(program);
|
|
39226
39332
|
registerReview(program);
|
|
39333
|
+
registerRules(program);
|
|
39227
39334
|
registerDevlog(program);
|
|
39228
39335
|
registerDeploy(program);
|
|
39229
39336
|
registerComplexity(program);
|