@staff0rd/assist 0.593.0 → 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 +4 -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 +568 -476
- 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`);
|
|
@@ -30981,10 +31072,10 @@ function registerSync(program2) {
|
|
|
30981
31072
|
}
|
|
30982
31073
|
|
|
30983
31074
|
// src/commands/transcript/clean.ts
|
|
30984
|
-
import { existsSync as
|
|
31075
|
+
import { existsSync as existsSync66 } from "fs";
|
|
30985
31076
|
|
|
30986
31077
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
30987
|
-
import { readFileSync as
|
|
31078
|
+
import { readFileSync as readFileSync51 } from "fs";
|
|
30988
31079
|
|
|
30989
31080
|
// src/commands/transcript/cleanText.ts
|
|
30990
31081
|
function cleanText(text18) {
|
|
@@ -31191,14 +31282,14 @@ function formatChatLog(messages) {
|
|
|
31191
31282
|
|
|
31192
31283
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
31193
31284
|
function convertVttToMarkdown(inputPath) {
|
|
31194
|
-
const cues = parseVtt(
|
|
31285
|
+
const cues = parseVtt(readFileSync51(inputPath, "utf8"));
|
|
31195
31286
|
const messages = cuesToChatMessages(deduplicateCues(cues));
|
|
31196
31287
|
return formatChatLog(messages);
|
|
31197
31288
|
}
|
|
31198
31289
|
|
|
31199
31290
|
// src/commands/transcript/clean.ts
|
|
31200
31291
|
function clean(file) {
|
|
31201
|
-
if (!
|
|
31292
|
+
if (!existsSync66(file)) {
|
|
31202
31293
|
console.error(`Error: VTT file not found: ${file}`);
|
|
31203
31294
|
process.exit(1);
|
|
31204
31295
|
}
|
|
@@ -31281,20 +31372,20 @@ async function configure() {
|
|
|
31281
31372
|
}
|
|
31282
31373
|
|
|
31283
31374
|
// src/commands/transcript/list.ts
|
|
31284
|
-
import { existsSync as
|
|
31375
|
+
import { existsSync as existsSync67, readdirSync as readdirSync19, statSync as statSync11 } from "fs";
|
|
31285
31376
|
import { join as join78 } from "path";
|
|
31286
31377
|
function list4() {
|
|
31287
31378
|
const { vttDir } = getTranscriptConfig();
|
|
31288
|
-
if (!
|
|
31379
|
+
if (!existsSync67(vttDir)) return;
|
|
31289
31380
|
for (const entry of readdirSync19(vttDir)) {
|
|
31290
31381
|
if (!entry.endsWith(".vtt")) continue;
|
|
31291
|
-
if (
|
|
31382
|
+
if (statSync11(join78(vttDir, entry)).isDirectory()) continue;
|
|
31292
31383
|
console.log(entry);
|
|
31293
31384
|
}
|
|
31294
31385
|
}
|
|
31295
31386
|
|
|
31296
31387
|
// src/commands/transcript/move.ts
|
|
31297
|
-
import { existsSync as
|
|
31388
|
+
import { existsSync as existsSync68, mkdirSync as mkdirSync27, renameSync as renameSync2, writeFileSync as writeFileSync43 } from "fs";
|
|
31298
31389
|
import { basename as basename21, join as join79 } from "path";
|
|
31299
31390
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
31300
31391
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
@@ -31311,7 +31402,7 @@ function move(file, options2) {
|
|
|
31311
31402
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
31312
31403
|
const filename = basename21(file);
|
|
31313
31404
|
const sourcePath = join79(vttDir, filename);
|
|
31314
|
-
if (!
|
|
31405
|
+
if (!existsSync68(sourcePath)) {
|
|
31315
31406
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
31316
31407
|
process.exit(1);
|
|
31317
31408
|
}
|
|
@@ -31441,14 +31532,14 @@ function devices() {
|
|
|
31441
31532
|
}
|
|
31442
31533
|
|
|
31443
31534
|
// src/commands/voice/logs.ts
|
|
31444
|
-
import { existsSync as
|
|
31535
|
+
import { existsSync as existsSync69, readFileSync as readFileSync52 } from "fs";
|
|
31445
31536
|
function logs(options2) {
|
|
31446
|
-
if (!
|
|
31537
|
+
if (!existsSync69(voicePaths.log)) {
|
|
31447
31538
|
console.log("No voice log file found");
|
|
31448
31539
|
return;
|
|
31449
31540
|
}
|
|
31450
31541
|
const count8 = Number.parseInt(options2.lines ?? "150", 10);
|
|
31451
|
-
const content =
|
|
31542
|
+
const content = readFileSync52(voicePaths.log, "utf8").trim();
|
|
31452
31543
|
if (!content) {
|
|
31453
31544
|
console.log("Voice log is empty");
|
|
31454
31545
|
return;
|
|
@@ -31475,7 +31566,7 @@ import { join as join83 } from "path";
|
|
|
31475
31566
|
|
|
31476
31567
|
// src/commands/voice/checkLockFile.ts
|
|
31477
31568
|
import { execSync as execSync58 } from "child_process";
|
|
31478
|
-
import { existsSync as
|
|
31569
|
+
import { existsSync as existsSync70, mkdirSync as mkdirSync28, readFileSync as readFileSync53, writeFileSync as writeFileSync44 } from "fs";
|
|
31479
31570
|
import { join as join82 } from "path";
|
|
31480
31571
|
function isProcessAlive2(pid) {
|
|
31481
31572
|
try {
|
|
@@ -31487,9 +31578,9 @@ function isProcessAlive2(pid) {
|
|
|
31487
31578
|
}
|
|
31488
31579
|
function checkLockFile() {
|
|
31489
31580
|
const lockFile = getLockFile();
|
|
31490
|
-
if (!
|
|
31581
|
+
if (!existsSync70(lockFile)) return;
|
|
31491
31582
|
try {
|
|
31492
|
-
const lock2 = JSON.parse(
|
|
31583
|
+
const lock2 = JSON.parse(readFileSync53(lockFile, "utf8"));
|
|
31493
31584
|
if (lock2.pid && isProcessAlive2(lock2.pid)) {
|
|
31494
31585
|
console.error(
|
|
31495
31586
|
`Voice daemon already running (PID ${lock2.pid}, env: ${lock2.env}). Stop it first with: assist voice stop`
|
|
@@ -31500,7 +31591,7 @@ function checkLockFile() {
|
|
|
31500
31591
|
}
|
|
31501
31592
|
}
|
|
31502
31593
|
function bootstrapVenv() {
|
|
31503
|
-
if (
|
|
31594
|
+
if (existsSync70(getVenvPython())) return;
|
|
31504
31595
|
console.log("Setting up Python environment...");
|
|
31505
31596
|
const pythonDir = getPythonDir();
|
|
31506
31597
|
execSync58(
|
|
@@ -31591,7 +31682,7 @@ function start2(options2) {
|
|
|
31591
31682
|
}
|
|
31592
31683
|
|
|
31593
31684
|
// src/commands/voice/status.ts
|
|
31594
|
-
import { existsSync as
|
|
31685
|
+
import { existsSync as existsSync71, readFileSync as readFileSync54 } from "fs";
|
|
31595
31686
|
function isProcessAlive3(pid) {
|
|
31596
31687
|
try {
|
|
31597
31688
|
process.kill(pid, 0);
|
|
@@ -31601,16 +31692,16 @@ function isProcessAlive3(pid) {
|
|
|
31601
31692
|
}
|
|
31602
31693
|
}
|
|
31603
31694
|
function readRecentLogs(count8) {
|
|
31604
|
-
if (!
|
|
31605
|
-
const lines2 =
|
|
31695
|
+
if (!existsSync71(voicePaths.log)) return [];
|
|
31696
|
+
const lines2 = readFileSync54(voicePaths.log, "utf8").trim().split("\n");
|
|
31606
31697
|
return lines2.slice(-count8);
|
|
31607
31698
|
}
|
|
31608
31699
|
function status2() {
|
|
31609
|
-
if (!
|
|
31700
|
+
if (!existsSync71(voicePaths.pid)) {
|
|
31610
31701
|
console.log("Voice daemon: not running (no PID file)");
|
|
31611
31702
|
return;
|
|
31612
31703
|
}
|
|
31613
|
-
const pid = Number.parseInt(
|
|
31704
|
+
const pid = Number.parseInt(readFileSync54(voicePaths.pid, "utf8").trim(), 10);
|
|
31614
31705
|
const alive = isProcessAlive3(pid);
|
|
31615
31706
|
console.log(`Voice daemon: ${alive ? "running" : "dead"} (PID ${pid})`);
|
|
31616
31707
|
const recent = readRecentLogs(5);
|
|
@@ -31629,13 +31720,13 @@ function status2() {
|
|
|
31629
31720
|
}
|
|
31630
31721
|
|
|
31631
31722
|
// src/commands/voice/stop.ts
|
|
31632
|
-
import { existsSync as
|
|
31723
|
+
import { existsSync as existsSync72, readFileSync as readFileSync55, unlinkSync as unlinkSync20 } from "fs";
|
|
31633
31724
|
function stop2() {
|
|
31634
|
-
if (!
|
|
31725
|
+
if (!existsSync72(voicePaths.pid)) {
|
|
31635
31726
|
console.log("Voice daemon is not running (no PID file)");
|
|
31636
31727
|
return;
|
|
31637
31728
|
}
|
|
31638
|
-
const pid = Number.parseInt(
|
|
31729
|
+
const pid = Number.parseInt(readFileSync55(voicePaths.pid, "utf8").trim(), 10);
|
|
31639
31730
|
try {
|
|
31640
31731
|
process.kill(pid, "SIGTERM");
|
|
31641
31732
|
console.log(`Sent SIGTERM to voice daemon (PID ${pid})`);
|
|
@@ -31648,7 +31739,7 @@ function stop2() {
|
|
|
31648
31739
|
}
|
|
31649
31740
|
try {
|
|
31650
31741
|
const lockFile = getLockFile();
|
|
31651
|
-
if (
|
|
31742
|
+
if (existsSync72(lockFile)) unlinkSync20(lockFile);
|
|
31652
31743
|
} catch {
|
|
31653
31744
|
}
|
|
31654
31745
|
console.log("Voice daemon stopped");
|
|
@@ -31773,11 +31864,11 @@ var webUiPrefix = "src/commands/sessions/web/ui/";
|
|
|
31773
31864
|
var sessionsPrefix = "src/commands/sessions/";
|
|
31774
31865
|
var rules = [
|
|
31775
31866
|
{
|
|
31776
|
-
matches: (
|
|
31867
|
+
matches: (path83) => path83.startsWith(webUiPrefix),
|
|
31777
31868
|
advice: "restart the web server, then hard-reload the browser tab"
|
|
31778
31869
|
},
|
|
31779
31870
|
{
|
|
31780
|
-
matches: (
|
|
31871
|
+
matches: (path83) => path83.startsWith(sessionsPrefix) && !path83.startsWith(webUiPrefix),
|
|
31781
31872
|
advice: "restart the daemon"
|
|
31782
31873
|
}
|
|
31783
31874
|
];
|
|
@@ -31788,31 +31879,31 @@ function restartAdvice(paths) {
|
|
|
31788
31879
|
// src/commands/watch/syncAdvice.ts
|
|
31789
31880
|
var rules2 = [
|
|
31790
31881
|
{
|
|
31791
|
-
matches: (
|
|
31882
|
+
matches: (path83) => path83.startsWith("claude/commands/"),
|
|
31792
31883
|
reason: "claude/commands changed"
|
|
31793
31884
|
},
|
|
31794
31885
|
{
|
|
31795
|
-
matches: (
|
|
31886
|
+
matches: (path83) => path83.startsWith("claude/skills/"),
|
|
31796
31887
|
reason: "claude/skills changed"
|
|
31797
31888
|
},
|
|
31798
31889
|
{
|
|
31799
|
-
matches: (
|
|
31890
|
+
matches: (path83) => path83 === "claude/settings.json",
|
|
31800
31891
|
reason: "claude/settings.json changed"
|
|
31801
31892
|
},
|
|
31802
31893
|
{
|
|
31803
|
-
matches: (
|
|
31894
|
+
matches: (path83) => path83 === "claude/CLAUDE.md",
|
|
31804
31895
|
reason: "claude/CLAUDE.md changed"
|
|
31805
31896
|
},
|
|
31806
31897
|
{
|
|
31807
|
-
matches: (
|
|
31898
|
+
matches: (path83) => path83 === "claude/design-system-prompt.md",
|
|
31808
31899
|
reason: "claude/design-system-prompt.md changed"
|
|
31809
31900
|
},
|
|
31810
31901
|
{
|
|
31811
|
-
matches: (
|
|
31902
|
+
matches: (path83) => path83.startsWith("codex/"),
|
|
31812
31903
|
reason: "codex sources changed"
|
|
31813
31904
|
},
|
|
31814
31905
|
{
|
|
31815
|
-
matches: (
|
|
31906
|
+
matches: (path83) => path83.startsWith("pi/"),
|
|
31816
31907
|
reason: "pi sources changed"
|
|
31817
31908
|
}
|
|
31818
31909
|
];
|
|
@@ -32053,7 +32144,7 @@ function resolveParams(params, cliArgs) {
|
|
|
32053
32144
|
}
|
|
32054
32145
|
|
|
32055
32146
|
// src/commands/run/resolveRunCwd.ts
|
|
32056
|
-
import { existsSync as
|
|
32147
|
+
import { existsSync as existsSync73 } from "fs";
|
|
32057
32148
|
import { resolve as resolve19 } from "path";
|
|
32058
32149
|
var MissingRunCwdError = class extends Error {
|
|
32059
32150
|
constructor(runName, cwd) {
|
|
@@ -32066,17 +32157,17 @@ var MissingRunCwdError = class extends Error {
|
|
|
32066
32157
|
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
32067
32158
|
if (!config.cwd) return void 0;
|
|
32068
32159
|
const cwd = resolve19(baseDir, config.cwd);
|
|
32069
|
-
if (!
|
|
32160
|
+
if (!existsSync73(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
32070
32161
|
return cwd;
|
|
32071
32162
|
}
|
|
32072
32163
|
|
|
32073
32164
|
// src/commands/run/runCommandToCompletion.ts
|
|
32074
32165
|
import { spawn as spawn9 } from "child_process";
|
|
32075
|
-
import { existsSync as
|
|
32166
|
+
import { existsSync as existsSync75 } from "fs";
|
|
32076
32167
|
|
|
32077
32168
|
// src/commands/run/resolveCommand.ts
|
|
32078
32169
|
import { execFileSync as execFileSync16 } from "child_process";
|
|
32079
|
-
import { existsSync as
|
|
32170
|
+
import { existsSync as existsSync74 } from "fs";
|
|
32080
32171
|
import { dirname as dirname37, join as join86, resolve as resolve20 } from "path";
|
|
32081
32172
|
function resolveCommand2(command) {
|
|
32082
32173
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
@@ -32084,7 +32175,7 @@ function resolveCommand2(command) {
|
|
|
32084
32175
|
const gitPath = execFileSync16("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
32085
32176
|
const gitRoot = resolve20(dirname37(gitPath), "..");
|
|
32086
32177
|
const gitBash = join86(gitRoot, "bin", "bash.exe");
|
|
32087
|
-
if (
|
|
32178
|
+
if (existsSync74(gitBash)) return gitBash;
|
|
32088
32179
|
} catch {
|
|
32089
32180
|
return command;
|
|
32090
32181
|
}
|
|
@@ -32094,7 +32185,7 @@ function resolveCommand2(command) {
|
|
|
32094
32185
|
// src/commands/run/runCommandToCompletion.ts
|
|
32095
32186
|
function runCommandToCompletion(command, args, env, cwd, quiet) {
|
|
32096
32187
|
return new Promise((resolveResult) => {
|
|
32097
|
-
if (cwd && !
|
|
32188
|
+
if (cwd && !existsSync75(cwd)) {
|
|
32098
32189
|
resolveResult({
|
|
32099
32190
|
kind: "failed",
|
|
32100
32191
|
message: `Failed to execute command: cwd ${cwd} does not exist`
|
|
@@ -32351,7 +32442,7 @@ function registerWatch(program2) {
|
|
|
32351
32442
|
|
|
32352
32443
|
// src/commands/roam/auth.ts
|
|
32353
32444
|
import { randomBytes } from "crypto";
|
|
32354
|
-
import
|
|
32445
|
+
import chalk222 from "chalk";
|
|
32355
32446
|
|
|
32356
32447
|
// src/commands/roam/waitForCallback.ts
|
|
32357
32448
|
import { createServer as createServer3 } from "http";
|
|
@@ -32482,13 +32573,13 @@ async function auth() {
|
|
|
32482
32573
|
saveGlobalConfig(config);
|
|
32483
32574
|
const state = randomBytes(16).toString("hex");
|
|
32484
32575
|
console.log(
|
|
32485
|
-
|
|
32576
|
+
chalk222.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
32486
32577
|
);
|
|
32487
|
-
console.log(
|
|
32488
|
-
console.log(
|
|
32489
|
-
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..."));
|
|
32490
32581
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
32491
|
-
console.log(
|
|
32582
|
+
console.log(chalk222.dim("Exchanging code for tokens..."));
|
|
32492
32583
|
const tokens = await exchangeToken({
|
|
32493
32584
|
code,
|
|
32494
32585
|
clientId,
|
|
@@ -32504,13 +32595,13 @@ async function auth() {
|
|
|
32504
32595
|
};
|
|
32505
32596
|
saveGlobalConfig(config);
|
|
32506
32597
|
console.log(
|
|
32507
|
-
|
|
32598
|
+
chalk222.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
32508
32599
|
);
|
|
32509
32600
|
}
|
|
32510
32601
|
|
|
32511
32602
|
// src/commands/roam/postRoamActivity.ts
|
|
32512
32603
|
import { execFileSync as execFileSync18 } from "child_process";
|
|
32513
|
-
import { readdirSync as readdirSync20, readFileSync as
|
|
32604
|
+
import { readdirSync as readdirSync20, readFileSync as readFileSync56, statSync as statSync12 } from "fs";
|
|
32514
32605
|
import { join as join87 } from "path";
|
|
32515
32606
|
function findPortFile(roamDir) {
|
|
32516
32607
|
let entries;
|
|
@@ -32520,9 +32611,9 @@ function findPortFile(roamDir) {
|
|
|
32520
32611
|
return void 0;
|
|
32521
32612
|
}
|
|
32522
32613
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
32523
|
-
const
|
|
32614
|
+
const path83 = join87(roamDir, name);
|
|
32524
32615
|
try {
|
|
32525
|
-
return { path:
|
|
32616
|
+
return { path: path83, mtimeMs: statSync12(path83).mtimeMs };
|
|
32526
32617
|
} catch {
|
|
32527
32618
|
return void 0;
|
|
32528
32619
|
}
|
|
@@ -32536,7 +32627,7 @@ function postRoamActivity(app, event) {
|
|
|
32536
32627
|
if (!portFile) return;
|
|
32537
32628
|
let port;
|
|
32538
32629
|
try {
|
|
32539
|
-
port =
|
|
32630
|
+
port = readFileSync56(portFile, "utf8").trim();
|
|
32540
32631
|
} catch {
|
|
32541
32632
|
return;
|
|
32542
32633
|
}
|
|
@@ -32758,11 +32849,11 @@ function findLinkIndex() {
|
|
|
32758
32849
|
function parseLinkArgs() {
|
|
32759
32850
|
const idx = findLinkIndex();
|
|
32760
32851
|
if (idx === -1) return null;
|
|
32761
|
-
const
|
|
32852
|
+
const path83 = process.argv[idx + 1];
|
|
32762
32853
|
const rest = process.argv.slice(idx + 2);
|
|
32763
32854
|
const { value: prefix2 } = extractOption(rest, "--prefix");
|
|
32764
32855
|
if (!prefix2) return null;
|
|
32765
|
-
return { path:
|
|
32856
|
+
return { path: path83, prefix: prefix2 };
|
|
32766
32857
|
}
|
|
32767
32858
|
function hasDuplicateLink(runList, linkPath) {
|
|
32768
32859
|
return runList.some(
|
|
@@ -32790,7 +32881,7 @@ function link2() {
|
|
|
32790
32881
|
}
|
|
32791
32882
|
|
|
32792
32883
|
// src/commands/run/remove.ts
|
|
32793
|
-
import { existsSync as
|
|
32884
|
+
import { existsSync as existsSync76, unlinkSync as unlinkSync21 } from "fs";
|
|
32794
32885
|
import { join as join89 } from "path";
|
|
32795
32886
|
function findRemoveIndex() {
|
|
32796
32887
|
const idx = process.argv.indexOf("remove");
|
|
@@ -32807,7 +32898,7 @@ function parseRemoveName() {
|
|
|
32807
32898
|
}
|
|
32808
32899
|
function deleteCommandFile(name) {
|
|
32809
32900
|
const filePath = join89(".claude", "commands", `${name}.md`);
|
|
32810
|
-
if (
|
|
32901
|
+
if (existsSync76(filePath)) {
|
|
32811
32902
|
unlinkSync21(filePath);
|
|
32812
32903
|
console.log(`Deleted command file: ${filePath}`);
|
|
32813
32904
|
}
|
|
@@ -32852,10 +32943,10 @@ function registerRun(program2) {
|
|
|
32852
32943
|
|
|
32853
32944
|
// src/commands/screenshot/index.ts
|
|
32854
32945
|
import { execSync as execSync60 } from "child_process";
|
|
32855
|
-
import { existsSync as
|
|
32946
|
+
import { existsSync as existsSync77, mkdirSync as mkdirSync32, unlinkSync as unlinkSync22, writeFileSync as writeFileSync47 } from "fs";
|
|
32856
32947
|
import { tmpdir as tmpdir8 } from "os";
|
|
32857
32948
|
import { join as join90, resolve as resolve21 } from "path";
|
|
32858
|
-
import
|
|
32949
|
+
import chalk223 from "chalk";
|
|
32859
32950
|
|
|
32860
32951
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
32861
32952
|
var captureWindowPs1 = `
|
|
@@ -32984,7 +33075,7 @@ Write-Output $OutputPath
|
|
|
32984
33075
|
|
|
32985
33076
|
// src/commands/screenshot/index.ts
|
|
32986
33077
|
function buildOutputPath(outputDir, processName) {
|
|
32987
|
-
if (!
|
|
33078
|
+
if (!existsSync77(outputDir)) {
|
|
32988
33079
|
mkdirSync32(outputDir, { recursive: true });
|
|
32989
33080
|
}
|
|
32990
33081
|
const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
@@ -33006,13 +33097,13 @@ function screenshot(processName) {
|
|
|
33006
33097
|
const config = loadConfig();
|
|
33007
33098
|
const outputDir = resolve21(config.screenshot.outputDir);
|
|
33008
33099
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
33009
|
-
console.log(
|
|
33100
|
+
console.log(chalk223.gray(`Capturing window for process "${processName}" ...`));
|
|
33010
33101
|
try {
|
|
33011
33102
|
runPowerShellScript(processName, outputPath);
|
|
33012
|
-
console.log(
|
|
33103
|
+
console.log(chalk223.green(`Screenshot saved: ${outputPath}`));
|
|
33013
33104
|
} catch (error) {
|
|
33014
33105
|
const msg = error instanceof Error ? error.message : String(error);
|
|
33015
|
-
console.error(
|
|
33106
|
+
console.error(chalk223.red(`Failed to capture screenshot: ${msg}`));
|
|
33016
33107
|
process.exit(1);
|
|
33017
33108
|
}
|
|
33018
33109
|
}
|
|
@@ -33068,11 +33159,11 @@ function applyLine(result, pending, line) {
|
|
|
33068
33159
|
}
|
|
33069
33160
|
|
|
33070
33161
|
// src/commands/sessions/daemon/readDaemonPidFile.ts
|
|
33071
|
-
import { readFileSync as
|
|
33162
|
+
import { readFileSync as readFileSync57 } from "fs";
|
|
33072
33163
|
function readDaemonPidFile() {
|
|
33073
33164
|
try {
|
|
33074
33165
|
const pid = Number.parseInt(
|
|
33075
|
-
|
|
33166
|
+
readFileSync57(daemonPaths.pid, "utf8").trim(),
|
|
33076
33167
|
10
|
|
33077
33168
|
);
|
|
33078
33169
|
return Number.isInteger(pid) ? pid : void 0;
|
|
@@ -33329,12 +33420,12 @@ function toSessionRunInfo({
|
|
|
33329
33420
|
}
|
|
33330
33421
|
|
|
33331
33422
|
// src/commands/sessions/daemon/worktree/joinRefusal.ts
|
|
33332
|
-
import { existsSync as
|
|
33423
|
+
import { existsSync as existsSync78 } from "fs";
|
|
33333
33424
|
function joinRefusal(session) {
|
|
33334
33425
|
if (session.commandType === "run") return "a server run has no agent stream";
|
|
33335
33426
|
if (session.closing === true) return "the session is closing";
|
|
33336
33427
|
if (!session.cwd) return "the session has no working directory";
|
|
33337
|
-
if (!
|
|
33428
|
+
if (!existsSync78(session.cwd))
|
|
33338
33429
|
return "the session's workspace no longer exists";
|
|
33339
33430
|
return void 0;
|
|
33340
33431
|
}
|
|
@@ -33498,27 +33589,27 @@ function sessionBase(id, status3) {
|
|
|
33498
33589
|
}
|
|
33499
33590
|
|
|
33500
33591
|
// src/commands/sessions/daemon/spawnPty.ts
|
|
33501
|
-
import { existsSync as
|
|
33592
|
+
import { existsSync as existsSync80 } from "fs";
|
|
33502
33593
|
import * as pty from "node-pty";
|
|
33503
33594
|
|
|
33504
33595
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
33505
|
-
import { chmodSync, existsSync as
|
|
33596
|
+
import { chmodSync, existsSync as existsSync79, statSync as statSync13 } from "fs";
|
|
33506
33597
|
import { createRequire as createRequire3 } from "module";
|
|
33507
|
-
import
|
|
33598
|
+
import path78 from "path";
|
|
33508
33599
|
var require4 = createRequire3(import.meta.url);
|
|
33509
33600
|
var ensured = false;
|
|
33510
33601
|
function ensureSpawnHelperExecutable() {
|
|
33511
33602
|
if (ensured || process.platform !== "darwin") return;
|
|
33512
33603
|
ensured = true;
|
|
33513
|
-
const ptyRoot =
|
|
33514
|
-
const helper =
|
|
33604
|
+
const ptyRoot = path78.join(path78.dirname(require4.resolve("node-pty")), "..");
|
|
33605
|
+
const helper = path78.join(
|
|
33515
33606
|
ptyRoot,
|
|
33516
33607
|
"prebuilds",
|
|
33517
33608
|
`${process.platform}-${process.arch}`,
|
|
33518
33609
|
"spawn-helper"
|
|
33519
33610
|
);
|
|
33520
|
-
if (!
|
|
33521
|
-
const mode =
|
|
33611
|
+
if (!existsSync79(helper)) return;
|
|
33612
|
+
const mode = statSync13(helper).mode;
|
|
33522
33613
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
33523
33614
|
}
|
|
33524
33615
|
|
|
@@ -33553,7 +33644,7 @@ function spawnPty(args, cwd, sessionId, extraEnv) {
|
|
|
33553
33644
|
});
|
|
33554
33645
|
}
|
|
33555
33646
|
function refuseMissingCwd(cwd, sessionId) {
|
|
33556
|
-
if (!cwd ||
|
|
33647
|
+
if (!cwd || existsSync80(cwd)) return;
|
|
33557
33648
|
daemonLog(
|
|
33558
33649
|
`${sessionId ? `session ${sessionId}` : "pty"} not spawned: working directory ${cwd} no longer exists`
|
|
33559
33650
|
);
|
|
@@ -33632,12 +33723,12 @@ function serverRunMeta(runName, cwd) {
|
|
|
33632
33723
|
|
|
33633
33724
|
// src/commands/sessions/daemon/readDesignSystemPrompt.ts
|
|
33634
33725
|
import * as fs49 from "fs";
|
|
33635
|
-
import * as
|
|
33726
|
+
import * as path79 from "path";
|
|
33636
33727
|
import { fileURLToPath as fileURLToPath10 } from "url";
|
|
33637
33728
|
var __filename5 = fileURLToPath10(import.meta.url);
|
|
33638
|
-
var __dirname7 =
|
|
33729
|
+
var __dirname7 = path79.dirname(__filename5);
|
|
33639
33730
|
function readDesignSystemPrompt() {
|
|
33640
|
-
const promptPath =
|
|
33731
|
+
const promptPath = path79.join(
|
|
33641
33732
|
__dirname7,
|
|
33642
33733
|
"..",
|
|
33643
33734
|
"claude",
|
|
@@ -33735,15 +33826,15 @@ function setStatus2(session, newStatus) {
|
|
|
33735
33826
|
}
|
|
33736
33827
|
|
|
33737
33828
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
33738
|
-
import { existsSync as
|
|
33829
|
+
import { existsSync as existsSync82 } from "fs";
|
|
33739
33830
|
import { basename as basename22 } from "path";
|
|
33740
33831
|
|
|
33741
33832
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
33742
|
-
import { existsSync as
|
|
33833
|
+
import { existsSync as existsSync81 } from "fs";
|
|
33743
33834
|
import { join as join93 } from "path";
|
|
33744
33835
|
|
|
33745
33836
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
33746
|
-
import { statSync as
|
|
33837
|
+
import { statSync as statSync14 } from "fs";
|
|
33747
33838
|
import { rm as rm2 } from "fs/promises";
|
|
33748
33839
|
import { join as join92 } from "path";
|
|
33749
33840
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
@@ -33773,7 +33864,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
33773
33864
|
return { removed: true };
|
|
33774
33865
|
}
|
|
33775
33866
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
33776
|
-
return
|
|
33867
|
+
return statSync14(join92(worktreePath, ".git"), {
|
|
33777
33868
|
throwIfNoEntry: false
|
|
33778
33869
|
})?.isDirectory() === true;
|
|
33779
33870
|
}
|
|
@@ -33809,7 +33900,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
33809
33900
|
);
|
|
33810
33901
|
}
|
|
33811
33902
|
function strandedReason(worktreePath, cause) {
|
|
33812
|
-
if (!
|
|
33903
|
+
if (!existsSync81(join93(worktreePath, ".git")))
|
|
33813
33904
|
return "its .git link is already gone";
|
|
33814
33905
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
33815
33906
|
return "git no longer recognises it as a working tree";
|
|
@@ -33861,7 +33952,7 @@ function reason3(error) {
|
|
|
33861
33952
|
|
|
33862
33953
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
33863
33954
|
async function reapWorktree(worktreePath, force = false) {
|
|
33864
|
-
if (!
|
|
33955
|
+
if (!existsSync82(worktreePath)) {
|
|
33865
33956
|
forgetWorktree(worktreePath);
|
|
33866
33957
|
daemonLog(
|
|
33867
33958
|
`worktree ${worktreePath} already gone; its record was forgotten`
|
|
@@ -33886,7 +33977,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
33886
33977
|
}
|
|
33887
33978
|
function owningClone(worktreePath) {
|
|
33888
33979
|
const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
|
|
33889
|
-
if (recorded &&
|
|
33980
|
+
if (recorded && existsSync82(recorded)) return recorded;
|
|
33890
33981
|
const detected = mainWorktree(worktreePath);
|
|
33891
33982
|
if (detected) return detected;
|
|
33892
33983
|
daemonLog(
|
|
@@ -34017,12 +34108,12 @@ function closeGateApplies(sessions, session) {
|
|
|
34017
34108
|
}
|
|
34018
34109
|
|
|
34019
34110
|
// src/commands/sessions/daemon/worktree/watchGitState.ts
|
|
34020
|
-
import { existsSync as
|
|
34111
|
+
import { existsSync as existsSync83, watch } from "fs";
|
|
34021
34112
|
var DEBOUNCE_MS = 500;
|
|
34022
34113
|
var POLL_MS = 3e4;
|
|
34023
34114
|
function watchGitState(cwd, onChange) {
|
|
34024
34115
|
const common = gitCommonDir(cwd);
|
|
34025
|
-
if (!common || !
|
|
34116
|
+
if (!common || !existsSync83(common)) return void 0;
|
|
34026
34117
|
const watchers = [
|
|
34027
34118
|
watchGitDir(common, onChange),
|
|
34028
34119
|
pollGitState(cwd, onChange)
|
|
@@ -34499,10 +34590,10 @@ function emitSessionOutput(session, clients, data) {
|
|
|
34499
34590
|
}
|
|
34500
34591
|
|
|
34501
34592
|
// src/commands/sessions/daemon/exitReason.ts
|
|
34502
|
-
import { existsSync as
|
|
34593
|
+
import { existsSync as existsSync84 } from "fs";
|
|
34503
34594
|
import { resolve as resolve22 } from "path";
|
|
34504
34595
|
function exitDetail(session) {
|
|
34505
|
-
if (session.cwd && !
|
|
34596
|
+
if (session.cwd && !existsSync84(session.cwd))
|
|
34506
34597
|
return `working directory ${session.cwd} no longer exists`;
|
|
34507
34598
|
return missingRunConfigCwd(session);
|
|
34508
34599
|
}
|
|
@@ -34516,7 +34607,7 @@ function missingRunConfigCwd(session) {
|
|
|
34516
34607
|
const config = resolveRunConfig(session.runName, dir);
|
|
34517
34608
|
if (!config?.cwd) return void 0;
|
|
34518
34609
|
const configured = resolve22(runConfigBaseDirFrom(dir), config.cwd);
|
|
34519
|
-
if (
|
|
34610
|
+
if (existsSync84(configured)) return void 0;
|
|
34520
34611
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
34521
34612
|
}
|
|
34522
34613
|
|
|
@@ -34557,7 +34648,7 @@ function handleFailedResume(session, exitCode, onStatusChange) {
|
|
|
34557
34648
|
}
|
|
34558
34649
|
|
|
34559
34650
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
34560
|
-
import { existsSync as
|
|
34651
|
+
import { existsSync as existsSync85, mkdirSync as mkdirSync33, watch as watch2 } from "fs";
|
|
34561
34652
|
import { dirname as dirname39 } from "path";
|
|
34562
34653
|
|
|
34563
34654
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
@@ -34619,8 +34710,8 @@ async function seedRunningMsFromUsage(session, notify2) {
|
|
|
34619
34710
|
var DEBOUNCE_MS2 = 50;
|
|
34620
34711
|
function watchActivity(session, notify2, onClaudeSessionId) {
|
|
34621
34712
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
34622
|
-
const
|
|
34623
|
-
const dir = dirname39(
|
|
34713
|
+
const path83 = activityPath(session.id);
|
|
34714
|
+
const dir = dirname39(path83);
|
|
34624
34715
|
try {
|
|
34625
34716
|
mkdirSync33(dir, { recursive: true });
|
|
34626
34717
|
} catch {
|
|
@@ -34630,7 +34721,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
34630
34721
|
let timer = null;
|
|
34631
34722
|
const read2 = () => {
|
|
34632
34723
|
timer = null;
|
|
34633
|
-
const activity2 = readActivity(
|
|
34724
|
+
const activity2 = readActivity(path83);
|
|
34634
34725
|
if (!activity2) return;
|
|
34635
34726
|
applyActivityToSession(session, activity2);
|
|
34636
34727
|
if (activity2.claudeSessionId) onClaudeSessionId?.(session);
|
|
@@ -34639,11 +34730,11 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
34639
34730
|
notify2();
|
|
34640
34731
|
};
|
|
34641
34732
|
session.activityWatcher = watch2(dir, (_event, filename) => {
|
|
34642
|
-
if (filename && !
|
|
34733
|
+
if (filename && !path83.endsWith(filename)) return;
|
|
34643
34734
|
if (timer) clearTimeout(timer);
|
|
34644
34735
|
timer = setTimeout(read2, DEBOUNCE_MS2);
|
|
34645
34736
|
});
|
|
34646
|
-
if (
|
|
34737
|
+
if (existsSync85(path83)) read2();
|
|
34647
34738
|
}
|
|
34648
34739
|
function refreshActivity(session) {
|
|
34649
34740
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -34786,12 +34877,12 @@ import { watch as watch3 } from "fs";
|
|
|
34786
34877
|
|
|
34787
34878
|
// src/commands/sessions/shared/findTranscriptPathSync.ts
|
|
34788
34879
|
import * as fs51 from "fs";
|
|
34789
|
-
import * as
|
|
34880
|
+
import * as path80 from "path";
|
|
34790
34881
|
function projectDirForCwd(cwd) {
|
|
34791
|
-
return
|
|
34882
|
+
return path80.join(claudeProjectsRoot(), projectSlug(cwd));
|
|
34792
34883
|
}
|
|
34793
34884
|
function transcriptPathFor(cwd, claudeSessionId) {
|
|
34794
|
-
return
|
|
34885
|
+
return path80.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
|
|
34795
34886
|
}
|
|
34796
34887
|
function findTranscriptPathSync(cwd, claudeSessionId) {
|
|
34797
34888
|
const direct = transcriptPathFor(cwd, claudeSessionId);
|
|
@@ -34805,8 +34896,8 @@ function findTranscriptPathSync(cwd, claudeSessionId) {
|
|
|
34805
34896
|
}
|
|
34806
34897
|
for (const file of files) {
|
|
34807
34898
|
if (!file.endsWith(".jsonl")) continue;
|
|
34808
|
-
if (headContainsSessionId(
|
|
34809
|
-
return
|
|
34899
|
+
if (headContainsSessionId(path80.join(dir, file), claudeSessionId))
|
|
34900
|
+
return path80.join(dir, file);
|
|
34810
34901
|
}
|
|
34811
34902
|
return null;
|
|
34812
34903
|
}
|
|
@@ -35980,9 +36071,9 @@ function tempRoots() {
|
|
|
35980
36071
|
}
|
|
35981
36072
|
return [...roots];
|
|
35982
36073
|
}
|
|
35983
|
-
function underTempRoot(
|
|
36074
|
+
function underTempRoot(path83) {
|
|
35984
36075
|
return tempRoots().some(
|
|
35985
|
-
(root) =>
|
|
36076
|
+
(root) => path83.startsWith(root.endsWith(sep2) ? root : root + sep2)
|
|
35986
36077
|
);
|
|
35987
36078
|
}
|
|
35988
36079
|
|
|
@@ -36294,7 +36385,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
36294
36385
|
}
|
|
36295
36386
|
|
|
36296
36387
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
36297
|
-
import { existsSync as
|
|
36388
|
+
import { existsSync as existsSync88 } from "fs";
|
|
36298
36389
|
import { basename as basename24 } from "path";
|
|
36299
36390
|
|
|
36300
36391
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
@@ -36349,18 +36440,18 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
36349
36440
|
}
|
|
36350
36441
|
|
|
36351
36442
|
// src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
|
|
36352
|
-
import { existsSync as
|
|
36443
|
+
import { existsSync as existsSync87 } from "fs";
|
|
36353
36444
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
36354
|
-
if (!
|
|
36355
|
-
for (const { path:
|
|
36445
|
+
if (!existsSync87(clone)) {
|
|
36446
|
+
for (const { path: path83 } of paths) forgetWorktree(path83);
|
|
36356
36447
|
daemonLog(
|
|
36357
36448
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
36358
36449
|
);
|
|
36359
36450
|
return;
|
|
36360
36451
|
}
|
|
36361
36452
|
await pruneBookkeeping2(clone);
|
|
36362
|
-
for (const { path:
|
|
36363
|
-
if (await reclaimBranch(clone, branch2)) forgetWorktree(
|
|
36453
|
+
for (const { path: path83, branch: branch2 } of paths)
|
|
36454
|
+
if (await reclaimBranch(clone, branch2)) forgetWorktree(path83);
|
|
36364
36455
|
}
|
|
36365
36456
|
async function pruneBookkeeping2(clone) {
|
|
36366
36457
|
try {
|
|
@@ -36387,37 +36478,37 @@ async function reclaimBranch(clone, branch2) {
|
|
|
36387
36478
|
}
|
|
36388
36479
|
|
|
36389
36480
|
// src/commands/sessions/daemon/worktree/logVanishedTree.ts
|
|
36390
|
-
function logVanishedTree(sessions,
|
|
36481
|
+
function logVanishedTree(sessions, path83) {
|
|
36391
36482
|
const claimants = [...sessions.values()].filter(
|
|
36392
|
-
(s) => s.cwd ===
|
|
36483
|
+
(s) => s.cwd === path83 || s.worktree?.path === path83
|
|
36393
36484
|
);
|
|
36394
36485
|
if (claimants.length === 0) {
|
|
36395
|
-
daemonLog(`worktree ${
|
|
36486
|
+
daemonLog(`worktree ${path83} gone from disk and unclaimed; reclaiming it`);
|
|
36396
36487
|
return;
|
|
36397
36488
|
}
|
|
36398
36489
|
for (const s of claimants)
|
|
36399
36490
|
daemonLog(
|
|
36400
|
-
`session ${s.id} ("${s.name}") claims worktree ${
|
|
36491
|
+
`session ${s.id} ("${s.name}") claims worktree ${path83}, which is gone from disk; reclaiming it`
|
|
36401
36492
|
);
|
|
36402
36493
|
}
|
|
36403
36494
|
|
|
36404
36495
|
// src/commands/sessions/daemon/worktree/describeHeldWork.ts
|
|
36405
36496
|
var MAX_ITEMS = 20;
|
|
36406
|
-
async function describeHeldWork(
|
|
36407
|
-
if (reason4.startsWith("uncommitted")) return await changedFiles(
|
|
36408
|
-
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);
|
|
36409
36500
|
return { summary: reason4, items: [] };
|
|
36410
36501
|
}
|
|
36411
|
-
async function changedFiles(
|
|
36412
|
-
const status3 = await gitResult(
|
|
36502
|
+
async function changedFiles(path83) {
|
|
36503
|
+
const status3 = await gitResult(path83, ["status", "--porcelain"]);
|
|
36413
36504
|
const lines2 = status3.ok ? nonEmptyLines(status3.out) : [];
|
|
36414
36505
|
return {
|
|
36415
36506
|
summary: `${lines2.length} uncommitted ${lines2.length === 1 ? "file" : "files"}`,
|
|
36416
36507
|
items: capped(lines2)
|
|
36417
36508
|
};
|
|
36418
36509
|
}
|
|
36419
|
-
async function unpushedCommits(
|
|
36420
|
-
const log2 = await gitResult(
|
|
36510
|
+
async function unpushedCommits(path83, reason4) {
|
|
36511
|
+
const log2 = await gitResult(path83, ["log", "--oneline", "@{upstream}..HEAD"]);
|
|
36421
36512
|
if (!log2.ok) return { summary: reason4, items: [] };
|
|
36422
36513
|
const lines2 = nonEmptyLines(log2.out);
|
|
36423
36514
|
return {
|
|
@@ -36509,24 +36600,24 @@ function reconcileWorktreesOnRestore(sessions, spawnWith, notify2) {
|
|
|
36509
36600
|
async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
36510
36601
|
const accounted = accountedTrees(sessions);
|
|
36511
36602
|
const vanished = /* @__PURE__ */ new Map();
|
|
36512
|
-
for (const { path:
|
|
36513
|
-
if (underTempRoot(
|
|
36514
|
-
forgetWorktree(
|
|
36603
|
+
for (const { path: path83, clone } of readWorktreeRegistry()) {
|
|
36604
|
+
if (underTempRoot(path83)) {
|
|
36605
|
+
forgetWorktree(path83);
|
|
36515
36606
|
daemonLog(
|
|
36516
|
-
`worktree ${
|
|
36607
|
+
`worktree ${path83} lies outside any project root; pruned from the registry rather than recovered`
|
|
36517
36608
|
);
|
|
36518
36609
|
continue;
|
|
36519
36610
|
}
|
|
36520
|
-
if (!
|
|
36521
|
-
logVanishedTree(sessions,
|
|
36611
|
+
if (!existsSync88(path83)) {
|
|
36612
|
+
logVanishedTree(sessions, path83);
|
|
36522
36613
|
vanished.set(clone, [
|
|
36523
36614
|
...vanished.get(clone) ?? [],
|
|
36524
|
-
{ path:
|
|
36615
|
+
{ path: path83, branch: basename24(path83) }
|
|
36525
36616
|
]);
|
|
36526
36617
|
continue;
|
|
36527
36618
|
}
|
|
36528
|
-
if (accounted.has(
|
|
36529
|
-
await recoverOrphan(sessions, spawnWith, { path:
|
|
36619
|
+
if (accounted.has(path83)) continue;
|
|
36620
|
+
await recoverOrphan(sessions, spawnWith, { path: path83, clone }, notify2);
|
|
36530
36621
|
}
|
|
36531
36622
|
for (const [clone, paths] of vanished)
|
|
36532
36623
|
await reclaimVanishedWorktrees(clone, paths);
|
|
@@ -37134,14 +37225,14 @@ async function defaultConnect() {
|
|
|
37134
37225
|
}
|
|
37135
37226
|
|
|
37136
37227
|
// src/commands/sessions/daemon/hasPersistedWindowsSessions.ts
|
|
37137
|
-
import { existsSync as
|
|
37228
|
+
import { existsSync as existsSync89, readFileSync as readFileSync59 } from "fs";
|
|
37138
37229
|
import { posix as posix3 } from "path";
|
|
37139
37230
|
function hasPersistedWindowsSessions() {
|
|
37140
37231
|
const sessionsFile = windowsSessionsFileFromWsl();
|
|
37141
37232
|
if (!sessionsFile) return false;
|
|
37142
37233
|
try {
|
|
37143
|
-
if (!
|
|
37144
|
-
const data = JSON.parse(
|
|
37234
|
+
if (!existsSync89(sessionsFile)) return false;
|
|
37235
|
+
const data = JSON.parse(readFileSync59(sessionsFile, "utf8"));
|
|
37145
37236
|
return Array.isArray(data) && data.length > 0;
|
|
37146
37237
|
} catch (error) {
|
|
37147
37238
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
@@ -37875,7 +37966,7 @@ function setAutoAdvance(sessions, id, enabled) {
|
|
|
37875
37966
|
}
|
|
37876
37967
|
|
|
37877
37968
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
37878
|
-
import { existsSync as
|
|
37969
|
+
import { existsSync as existsSync92 } from "fs";
|
|
37879
37970
|
|
|
37880
37971
|
// src/commands/sessions/daemon/resumeSession.ts
|
|
37881
37972
|
function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
@@ -37906,10 +37997,10 @@ function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
|
37906
37997
|
}
|
|
37907
37998
|
|
|
37908
37999
|
// src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
|
|
37909
|
-
import { existsSync as
|
|
38000
|
+
import { existsSync as existsSync91 } from "fs";
|
|
37910
38001
|
|
|
37911
38002
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
37912
|
-
import { copyFileSync as copyFileSync7, existsSync as
|
|
38003
|
+
import { copyFileSync as copyFileSync7, existsSync as existsSync90, mkdirSync as mkdirSync35 } from "fs";
|
|
37913
38004
|
import { join as join95 } from "path";
|
|
37914
38005
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
37915
38006
|
const dir = projectDirForCwd(toCwd);
|
|
@@ -37920,7 +38011,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
37920
38011
|
return;
|
|
37921
38012
|
}
|
|
37922
38013
|
const dest = join95(dir, `${claudeSessionId}.jsonl`);
|
|
37923
|
-
if (
|
|
38014
|
+
if (existsSync90(dest)) {
|
|
37924
38015
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
37925
38016
|
return;
|
|
37926
38017
|
}
|
|
@@ -37971,7 +38062,7 @@ function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name, harness
|
|
|
37971
38062
|
}
|
|
37972
38063
|
function cloneForReapedTree(missingCwd) {
|
|
37973
38064
|
const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
|
|
37974
|
-
if (!clone || !
|
|
38065
|
+
if (!clone || !existsSync91(clone))
|
|
37975
38066
|
throw new Error(
|
|
37976
38067
|
`working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
|
|
37977
38068
|
);
|
|
@@ -37980,7 +38071,7 @@ function cloneForReapedTree(missingCwd) {
|
|
|
37980
38071
|
|
|
37981
38072
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
37982
38073
|
function resumeInTree(ctx, sessionId, cwd, name, harness) {
|
|
37983
|
-
if (!
|
|
38074
|
+
if (!existsSync92(cwd))
|
|
37984
38075
|
return resumeInReplacementTree(ctx, sessionId, cwd, name, harness);
|
|
37985
38076
|
const id = ctx.spawnWith(
|
|
37986
38077
|
(sid) => resumeSession(sid, sessionId, cwd, name, void 0, harness)
|
|
@@ -38247,12 +38338,12 @@ function handleSetStatus(client, m, d) {
|
|
|
38247
38338
|
import * as fs54 from "fs";
|
|
38248
38339
|
|
|
38249
38340
|
// src/commands/sessions/shared/codex/findCodexRolloutPath.ts
|
|
38250
|
-
import * as
|
|
38341
|
+
import * as path81 from "path";
|
|
38251
38342
|
async function findCodexRolloutPath(sessionId) {
|
|
38252
38343
|
if (!sessionId) return null;
|
|
38253
38344
|
const paths = await discoverCodexRolloutPaths();
|
|
38254
38345
|
const suffix = `-${sessionId}.jsonl`;
|
|
38255
|
-
return paths.find((file) =>
|
|
38346
|
+
return paths.find((file) => path81.basename(file).endsWith(suffix)) ?? null;
|
|
38256
38347
|
}
|
|
38257
38348
|
|
|
38258
38349
|
// src/commands/sessions/shared/codex/codexToolTarget.ts
|
|
@@ -38560,7 +38651,7 @@ function handleConnection(socket, manager) {
|
|
|
38560
38651
|
import { unlinkSync as unlinkSync23, writeFileSync as writeFileSync48 } from "fs";
|
|
38561
38652
|
|
|
38562
38653
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
38563
|
-
import { readFileSync as
|
|
38654
|
+
import { readFileSync as readFileSync60 } from "fs";
|
|
38564
38655
|
var WATCHDOG_INTERVAL_MS = 5e3;
|
|
38565
38656
|
function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
38566
38657
|
const timer = setInterval(() => {
|
|
@@ -38571,7 +38662,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
|
38571
38662
|
}
|
|
38572
38663
|
function ownsPidFile() {
|
|
38573
38664
|
try {
|
|
38574
|
-
return
|
|
38665
|
+
return readFileSync60(daemonPaths.pid, "utf8").trim() === String(process.pid);
|
|
38575
38666
|
} catch {
|
|
38576
38667
|
return false;
|
|
38577
38668
|
}
|
|
@@ -38821,7 +38912,7 @@ function registerSetStatusCommand(cmd) {
|
|
|
38821
38912
|
|
|
38822
38913
|
// src/commands/sessions/summarise/index.ts
|
|
38823
38914
|
import * as fs56 from "fs";
|
|
38824
|
-
import
|
|
38915
|
+
import chalk224 from "chalk";
|
|
38825
38916
|
|
|
38826
38917
|
// src/commands/sessions/summarise/shared.ts
|
|
38827
38918
|
import * as fs55 from "fs";
|
|
@@ -38880,22 +38971,22 @@ ${firstMessage}`);
|
|
|
38880
38971
|
async function summarise2(options2) {
|
|
38881
38972
|
const files = await discoverSessionFiles();
|
|
38882
38973
|
if (files.length === 0) {
|
|
38883
|
-
console.log(
|
|
38974
|
+
console.log(chalk224.yellow("No sessions found."));
|
|
38884
38975
|
return;
|
|
38885
38976
|
}
|
|
38886
38977
|
const toProcess = selectCandidates(files, options2);
|
|
38887
38978
|
if (toProcess.length === 0) {
|
|
38888
|
-
console.log(
|
|
38979
|
+
console.log(chalk224.green("All sessions already summarised."));
|
|
38889
38980
|
return;
|
|
38890
38981
|
}
|
|
38891
38982
|
console.log(
|
|
38892
|
-
|
|
38983
|
+
chalk224.cyan(
|
|
38893
38984
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
38894
38985
|
)
|
|
38895
38986
|
);
|
|
38896
38987
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
38897
38988
|
console.log(
|
|
38898
|
-
|
|
38989
|
+
chalk224.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk224.yellow(`, ${failed2} skipped`) : "")
|
|
38899
38990
|
);
|
|
38900
38991
|
}
|
|
38901
38992
|
function selectCandidates(files, options2) {
|
|
@@ -38915,16 +39006,16 @@ function processSessions(files) {
|
|
|
38915
39006
|
let failed2 = 0;
|
|
38916
39007
|
for (let i = 0; i < files.length; i++) {
|
|
38917
39008
|
const file = files[i];
|
|
38918
|
-
process.stdout.write(
|
|
39009
|
+
process.stdout.write(chalk224.dim(` [${i + 1}/${files.length}] `));
|
|
38919
39010
|
const summary = summariseSession(file);
|
|
38920
39011
|
if (summary) {
|
|
38921
39012
|
writeSummary(file, summary);
|
|
38922
39013
|
succeeded++;
|
|
38923
|
-
process.stdout.write(`${
|
|
39014
|
+
process.stdout.write(`${chalk224.green("\u2713")} ${summary}
|
|
38924
39015
|
`);
|
|
38925
39016
|
} else {
|
|
38926
39017
|
failed2++;
|
|
38927
|
-
process.stdout.write(` ${
|
|
39018
|
+
process.stdout.write(` ${chalk224.yellow("skip")}
|
|
38928
39019
|
`);
|
|
38929
39020
|
}
|
|
38930
39021
|
}
|
|
@@ -38945,7 +39036,7 @@ function registerSessions(program2) {
|
|
|
38945
39036
|
}
|
|
38946
39037
|
|
|
38947
39038
|
// src/commands/statusLine.ts
|
|
38948
|
-
import
|
|
39039
|
+
import chalk226 from "chalk";
|
|
38949
39040
|
|
|
38950
39041
|
// src/shared/contextLevel.ts
|
|
38951
39042
|
function contextLevel(pct) {
|
|
@@ -38955,7 +39046,7 @@ function contextLevel(pct) {
|
|
|
38955
39046
|
}
|
|
38956
39047
|
|
|
38957
39048
|
// src/commands/buildLimitsSegment.ts
|
|
38958
|
-
import
|
|
39049
|
+
import chalk225 from "chalk";
|
|
38959
39050
|
|
|
38960
39051
|
// src/shared/rateLimitLevel.ts
|
|
38961
39052
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -38993,9 +39084,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
38993
39084
|
|
|
38994
39085
|
// src/commands/buildLimitsSegment.ts
|
|
38995
39086
|
var LEVEL_COLOR = {
|
|
38996
|
-
ok:
|
|
38997
|
-
warn:
|
|
38998
|
-
over:
|
|
39087
|
+
ok: chalk225.green,
|
|
39088
|
+
warn: chalk225.yellow,
|
|
39089
|
+
over: chalk225.red
|
|
38999
39090
|
};
|
|
39000
39091
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
39001
39092
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -39026,13 +39117,13 @@ function buildLimitsSegment(rateLimits) {
|
|
|
39026
39117
|
}
|
|
39027
39118
|
|
|
39028
39119
|
// src/commands/readGitBranch.ts
|
|
39029
|
-
import { readFileSync as
|
|
39120
|
+
import { readFileSync as readFileSync62, statSync as statSync16 } from "fs";
|
|
39030
39121
|
import { isAbsolute as isAbsolute5, join as join96, resolve as resolve23 } from "path";
|
|
39031
39122
|
function resolveGitDir(cwd) {
|
|
39032
39123
|
const dotGit = join96(cwd, ".git");
|
|
39033
39124
|
let stat4;
|
|
39034
39125
|
try {
|
|
39035
|
-
stat4 =
|
|
39126
|
+
stat4 = statSync16(dotGit);
|
|
39036
39127
|
} catch {
|
|
39037
39128
|
return null;
|
|
39038
39129
|
}
|
|
@@ -39041,7 +39132,7 @@ function resolveGitDir(cwd) {
|
|
|
39041
39132
|
}
|
|
39042
39133
|
let contents;
|
|
39043
39134
|
try {
|
|
39044
|
-
contents =
|
|
39135
|
+
contents = readFileSync62(dotGit, "utf8");
|
|
39045
39136
|
} catch {
|
|
39046
39137
|
return null;
|
|
39047
39138
|
}
|
|
@@ -39059,7 +39150,7 @@ function readGitBranch(cwd) {
|
|
|
39059
39150
|
}
|
|
39060
39151
|
let head;
|
|
39061
39152
|
try {
|
|
39062
|
-
head =
|
|
39153
|
+
head = readFileSync62(join96(gitDir, "HEAD"), "utf8");
|
|
39063
39154
|
} catch {
|
|
39064
39155
|
return null;
|
|
39065
39156
|
}
|
|
@@ -39091,7 +39182,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
39091
39182
|
}
|
|
39092
39183
|
|
|
39093
39184
|
// src/commands/statusLine.ts
|
|
39094
|
-
|
|
39185
|
+
chalk226.level = 3;
|
|
39095
39186
|
function formatNumber(num) {
|
|
39096
39187
|
return num.toLocaleString("en-US");
|
|
39097
39188
|
}
|
|
@@ -39099,9 +39190,9 @@ function colorizePercent(pct) {
|
|
|
39099
39190
|
const label2 = `${Math.round(pct)}%`;
|
|
39100
39191
|
switch (contextLevel(pct)) {
|
|
39101
39192
|
case "red":
|
|
39102
|
-
return
|
|
39193
|
+
return chalk226.red(label2);
|
|
39103
39194
|
case "yellow":
|
|
39104
|
-
return
|
|
39195
|
+
return chalk226.yellow(label2);
|
|
39105
39196
|
default:
|
|
39106
39197
|
return label2;
|
|
39107
39198
|
}
|
|
@@ -39114,7 +39205,7 @@ async function statusLine() {
|
|
|
39114
39205
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
39115
39206
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
39116
39207
|
const branch2 = dir ? readGitBranch(toGitCwd(dir)) : null;
|
|
39117
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
39208
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk226.cyan(branch2)} | ` : "";
|
|
39118
39209
|
console.log(
|
|
39119
39210
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
39120
39211
|
);
|
|
@@ -39128,7 +39219,7 @@ async function statusLine() {
|
|
|
39128
39219
|
|
|
39129
39220
|
// src/commands/update.ts
|
|
39130
39221
|
import { execSync as execSync61 } from "child_process";
|
|
39131
|
-
import * as
|
|
39222
|
+
import * as path82 from "path";
|
|
39132
39223
|
|
|
39133
39224
|
// src/commands/restartDaemonAfterUpdate.ts
|
|
39134
39225
|
async function restartDaemonAfterUpdate() {
|
|
@@ -39147,12 +39238,12 @@ async function restartDaemonAfterUpdate() {
|
|
|
39147
39238
|
// src/commands/update.ts
|
|
39148
39239
|
function isGlobalNpmInstall(dir) {
|
|
39149
39240
|
try {
|
|
39150
|
-
const resolved =
|
|
39151
|
-
if (resolved.split(
|
|
39241
|
+
const resolved = path82.resolve(dir);
|
|
39242
|
+
if (resolved.split(path82.sep).includes("node_modules")) {
|
|
39152
39243
|
return true;
|
|
39153
39244
|
}
|
|
39154
39245
|
const globalPrefix = execSync61("npm prefix -g", { stdio: "pipe" }).toString().trim();
|
|
39155
|
-
return resolved.toLowerCase().startsWith(
|
|
39246
|
+
return resolved.toLowerCase().startsWith(path82.resolve(globalPrefix).toLowerCase());
|
|
39156
39247
|
} catch {
|
|
39157
39248
|
return false;
|
|
39158
39249
|
}
|
|
@@ -39184,10 +39275,10 @@ async function update2() {
|
|
|
39184
39275
|
}
|
|
39185
39276
|
|
|
39186
39277
|
// src/reportCliError.ts
|
|
39187
|
-
import
|
|
39278
|
+
import chalk227 from "chalk";
|
|
39188
39279
|
function reportCliError(error) {
|
|
39189
39280
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError) {
|
|
39190
|
-
console.error(
|
|
39281
|
+
console.error(chalk227.red(error.message));
|
|
39191
39282
|
} else {
|
|
39192
39283
|
console.error(error);
|
|
39193
39284
|
}
|
|
@@ -39239,6 +39330,7 @@ registerList(program);
|
|
|
39239
39330
|
registerVerify(program);
|
|
39240
39331
|
registerRefactor(program);
|
|
39241
39332
|
registerReview(program);
|
|
39333
|
+
registerRules(program);
|
|
39242
39334
|
registerDevlog(program);
|
|
39243
39335
|
registerDeploy(program);
|
|
39244
39336
|
registerComplexity(program);
|