@staff0rd/assist 0.484.3 → 0.485.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/sessions/web/bundle.js +330 -330
- package/dist/index.js +253 -177
- 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.485.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -9089,6 +9089,28 @@ function getSessionParam(req) {
|
|
|
9089
9089
|
return url.searchParams.get("session") ?? void 0;
|
|
9090
9090
|
}
|
|
9091
9091
|
|
|
9092
|
+
// src/commands/sessions/web/execGit.ts
|
|
9093
|
+
import { execFile as execFile3 } from "child_process";
|
|
9094
|
+
import { promisify as promisify2 } from "util";
|
|
9095
|
+
var execFileAsync2 = promisify2(execFile3);
|
|
9096
|
+
async function execGit(cwd, args, opts = {}) {
|
|
9097
|
+
const { maxBuffer, allowFailure } = opts;
|
|
9098
|
+
const { file, argv } = /^[A-Za-z]:[\\/]/.test(cwd) ? { file: "git.exe", argv: ["-C", cwd, ...args] } : { file: "git", argv: args };
|
|
9099
|
+
try {
|
|
9100
|
+
const { stdout } = await execFileAsync2(file, argv, {
|
|
9101
|
+
encoding: "utf8",
|
|
9102
|
+
...maxBuffer ? { maxBuffer } : {},
|
|
9103
|
+
...file === "git" ? { cwd } : {}
|
|
9104
|
+
});
|
|
9105
|
+
return stdout;
|
|
9106
|
+
} catch (error) {
|
|
9107
|
+
if (allowFailure && error && typeof error === "object" && "stdout" in error) {
|
|
9108
|
+
return String(error.stdout);
|
|
9109
|
+
}
|
|
9110
|
+
throw error;
|
|
9111
|
+
}
|
|
9112
|
+
}
|
|
9113
|
+
|
|
9092
9114
|
// src/commands/sessions/web/windowsCwdToWslPath.ts
|
|
9093
9115
|
function windowsCwdToWslPath(cwd) {
|
|
9094
9116
|
const match = /^([A-Za-z]):[\\/](.*)$/.exec(cwd);
|
|
@@ -9103,6 +9125,49 @@ function toGitCwd(cwd) {
|
|
|
9103
9125
|
return detectPlatform() === "wsl" ? windowsCwdToWslPath(cwd) : cwd;
|
|
9104
9126
|
}
|
|
9105
9127
|
|
|
9128
|
+
// src/commands/sessions/web/defaultBranchRef.ts
|
|
9129
|
+
var ORIGIN_HEAD_REF = "refs/remotes/origin/HEAD";
|
|
9130
|
+
var ORIGIN_REF_PREFIX = "refs/remotes/origin/";
|
|
9131
|
+
function configuredDefaultBranch(cwd) {
|
|
9132
|
+
try {
|
|
9133
|
+
return loadConfigFrom(toGitCwd(cwd)).branch?.defaultBranch;
|
|
9134
|
+
} catch {
|
|
9135
|
+
return void 0;
|
|
9136
|
+
}
|
|
9137
|
+
}
|
|
9138
|
+
async function originHeadBranch(cwd) {
|
|
9139
|
+
try {
|
|
9140
|
+
const ref = (await execGit(cwd, ["symbolic-ref", "--quiet", ORIGIN_HEAD_REF])).trim();
|
|
9141
|
+
if (!ref.startsWith(ORIGIN_REF_PREFIX)) return void 0;
|
|
9142
|
+
return ref.slice(ORIGIN_REF_PREFIX.length) || void 0;
|
|
9143
|
+
} catch {
|
|
9144
|
+
return void 0;
|
|
9145
|
+
}
|
|
9146
|
+
}
|
|
9147
|
+
async function defaultBranchRef(cwd) {
|
|
9148
|
+
const branch2 = configuredDefaultBranch(cwd) ?? await originHeadBranch(cwd);
|
|
9149
|
+
if (!branch2) return void 0;
|
|
9150
|
+
const ref = `origin/${branch2}`;
|
|
9151
|
+
try {
|
|
9152
|
+
await execGit(cwd, ["rev-parse", "--verify", "--quiet", `${ref}^{commit}`]);
|
|
9153
|
+
return ref;
|
|
9154
|
+
} catch {
|
|
9155
|
+
return void 0;
|
|
9156
|
+
}
|
|
9157
|
+
}
|
|
9158
|
+
|
|
9159
|
+
// src/commands/sessions/web/branchDiffBase.ts
|
|
9160
|
+
async function branchDiffBase(cwd) {
|
|
9161
|
+
const ref = await defaultBranchRef(cwd);
|
|
9162
|
+
if (!ref) return void 0;
|
|
9163
|
+
try {
|
|
9164
|
+
const base = await execGit(cwd, ["merge-base", ref, "HEAD"]);
|
|
9165
|
+
return base.trim() || void 0;
|
|
9166
|
+
} catch {
|
|
9167
|
+
return void 0;
|
|
9168
|
+
}
|
|
9169
|
+
}
|
|
9170
|
+
|
|
9106
9171
|
// src/commands/sessions/web/includesCommittedChanges.ts
|
|
9107
9172
|
function includesCommittedChanges(cwd) {
|
|
9108
9173
|
try {
|
|
@@ -9158,33 +9223,15 @@ async function itemScopeCommits(cwd, sessionId) {
|
|
|
9158
9223
|
async function resolveDiffScope(cwd, sessionId, scope) {
|
|
9159
9224
|
if (!scope || scope === "all") return { kind: "all" };
|
|
9160
9225
|
if (scope === "uncommitted") return { kind: "uncommitted" };
|
|
9226
|
+
if (scope === "branch") {
|
|
9227
|
+
const base = await branchDiffBase(cwd);
|
|
9228
|
+
return base ? { kind: "branch", base } : void 0;
|
|
9229
|
+
}
|
|
9161
9230
|
const commits2 = await itemScopeCommits(cwd, sessionId);
|
|
9162
9231
|
if (!commits2.some((commit2) => commit2.sha === scope)) return void 0;
|
|
9163
9232
|
return { kind: "commit", sha: scope };
|
|
9164
9233
|
}
|
|
9165
9234
|
|
|
9166
|
-
// src/commands/sessions/web/execGit.ts
|
|
9167
|
-
import { execFile as execFile3 } from "child_process";
|
|
9168
|
-
import { promisify as promisify2 } from "util";
|
|
9169
|
-
var execFileAsync2 = promisify2(execFile3);
|
|
9170
|
-
async function execGit(cwd, args, opts = {}) {
|
|
9171
|
-
const { maxBuffer, allowFailure } = opts;
|
|
9172
|
-
const { file, argv } = /^[A-Za-z]:[\\/]/.test(cwd) ? { file: "git.exe", argv: ["-C", cwd, ...args] } : { file: "git", argv: args };
|
|
9173
|
-
try {
|
|
9174
|
-
const { stdout } = await execFileAsync2(file, argv, {
|
|
9175
|
-
encoding: "utf8",
|
|
9176
|
-
...maxBuffer ? { maxBuffer } : {},
|
|
9177
|
-
...file === "git" ? { cwd } : {}
|
|
9178
|
-
});
|
|
9179
|
-
return stdout;
|
|
9180
|
-
} catch (error) {
|
|
9181
|
-
if (allowFailure && error && typeof error === "object" && "stdout" in error) {
|
|
9182
|
-
return String(error.stdout);
|
|
9183
|
-
}
|
|
9184
|
-
throw error;
|
|
9185
|
-
}
|
|
9186
|
-
}
|
|
9187
|
-
|
|
9188
9235
|
// src/commands/sessions/web/resolveCommit.ts
|
|
9189
9236
|
var GIT_EMPTY_TREE_HASH = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
|
|
9190
9237
|
async function commitBase(cwd, sha) {
|
|
@@ -9291,8 +9338,7 @@ async function dirtyPaths(cwd, bases) {
|
|
|
9291
9338
|
var MAX_DIFF_BYTES = 50 * 1024 * 1024;
|
|
9292
9339
|
async function scopedDiff(cwd, session, scope) {
|
|
9293
9340
|
if (scope.kind === "commit") return commitDiff(cwd, scope.sha);
|
|
9294
|
-
|
|
9295
|
-
return tracked + await untrackedDiff(cwd);
|
|
9341
|
+
return await trackedScopeDiff(cwd, session, scope) + await untrackedDiff(cwd);
|
|
9296
9342
|
}
|
|
9297
9343
|
async function untrackedFileDiff(cwd, path71) {
|
|
9298
9344
|
return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path71], {
|
|
@@ -9322,8 +9368,16 @@ async function groupedDiff(cwd, groups) {
|
|
|
9322
9368
|
);
|
|
9323
9369
|
return diffs.join("");
|
|
9324
9370
|
}
|
|
9371
|
+
async function baseDiff(cwd, base) {
|
|
9372
|
+
return execGit(cwd, ["diff", base], { maxBuffer: MAX_DIFF_BYTES });
|
|
9373
|
+
}
|
|
9325
9374
|
async function workingTreeDiff(cwd) {
|
|
9326
|
-
return
|
|
9375
|
+
return baseDiff(cwd, "HEAD");
|
|
9376
|
+
}
|
|
9377
|
+
async function trackedScopeDiff(cwd, session, scope) {
|
|
9378
|
+
if (scope.kind === "branch") return baseDiff(cwd, scope.base);
|
|
9379
|
+
if (scope.kind === "uncommitted") return workingTreeDiff(cwd);
|
|
9380
|
+
return trackedDiff(cwd, session);
|
|
9327
9381
|
}
|
|
9328
9382
|
async function trackedDiff(cwd, session) {
|
|
9329
9383
|
const changeSet = await itemChangeSet(cwd, session);
|
|
@@ -9361,16 +9415,29 @@ async function diff2(req, res) {
|
|
|
9361
9415
|
}
|
|
9362
9416
|
|
|
9363
9417
|
// src/commands/sessions/web/diffScopes.ts
|
|
9364
|
-
async function
|
|
9365
|
-
const cwd = getCwdParam(req, res);
|
|
9366
|
-
if (!cwd) return;
|
|
9418
|
+
async function scopeCommits(cwd, sessionId) {
|
|
9367
9419
|
try {
|
|
9368
|
-
|
|
9369
|
-
respondJson(res, 200, { commits: commits2 });
|
|
9420
|
+
return await itemScopeCommits(cwd, sessionId);
|
|
9370
9421
|
} catch {
|
|
9371
|
-
|
|
9422
|
+
return [];
|
|
9372
9423
|
}
|
|
9373
9424
|
}
|
|
9425
|
+
async function branchBase(cwd) {
|
|
9426
|
+
try {
|
|
9427
|
+
return await defaultBranchRef(cwd) ?? null;
|
|
9428
|
+
} catch {
|
|
9429
|
+
return null;
|
|
9430
|
+
}
|
|
9431
|
+
}
|
|
9432
|
+
async function diffScopes(req, res) {
|
|
9433
|
+
const cwd = getCwdParam(req, res);
|
|
9434
|
+
if (!cwd) return;
|
|
9435
|
+
const [commits2, base] = await Promise.all([
|
|
9436
|
+
scopeCommits(cwd, getSessionParam(req)),
|
|
9437
|
+
branchBase(cwd)
|
|
9438
|
+
]);
|
|
9439
|
+
respondJson(res, 200, { commits: commits2, branchBase: base });
|
|
9440
|
+
}
|
|
9374
9441
|
|
|
9375
9442
|
// src/commands/sessions/web/fileContent.ts
|
|
9376
9443
|
import { readFile, stat as stat2 } from "fs/promises";
|
|
@@ -20463,21 +20530,33 @@ import { join as join55 } from "path";
|
|
|
20463
20530
|
|
|
20464
20531
|
// src/commands/prs/loadCommentsCache.ts
|
|
20465
20532
|
import { existsSync as existsSync47, readFileSync as readFileSync39, unlinkSync as unlinkSync13 } from "fs";
|
|
20466
|
-
import { join as join54 } from "path";
|
|
20467
20533
|
import { parse as parse2 } from "yaml";
|
|
20468
|
-
|
|
20469
|
-
|
|
20534
|
+
|
|
20535
|
+
// src/commands/prs/commentsCachePath.ts
|
|
20536
|
+
import { homedir as homedir20 } from "os";
|
|
20537
|
+
import { join as join54 } from "path";
|
|
20538
|
+
function commentsCachePath(org, repo, prNumber) {
|
|
20539
|
+
return join54(
|
|
20540
|
+
homedir20(),
|
|
20541
|
+
".assist",
|
|
20542
|
+
"pr-comments",
|
|
20543
|
+
org,
|
|
20544
|
+
repo,
|
|
20545
|
+
`pr-${prNumber}-comments.yaml`
|
|
20546
|
+
);
|
|
20470
20547
|
}
|
|
20471
|
-
|
|
20472
|
-
|
|
20548
|
+
|
|
20549
|
+
// src/commands/prs/loadCommentsCache.ts
|
|
20550
|
+
function loadCommentsCache(org, repo, prNumber) {
|
|
20551
|
+
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
20473
20552
|
if (!existsSync47(cachePath)) {
|
|
20474
20553
|
return null;
|
|
20475
20554
|
}
|
|
20476
20555
|
const content = readFileSync39(cachePath, "utf8");
|
|
20477
20556
|
return parse2(content);
|
|
20478
20557
|
}
|
|
20479
|
-
function deleteCommentsCache(prNumber) {
|
|
20480
|
-
const cachePath =
|
|
20558
|
+
function deleteCommentsCache(org, repo, prNumber) {
|
|
20559
|
+
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
20481
20560
|
if (existsSync47(cachePath)) {
|
|
20482
20561
|
unlinkSync13(cachePath);
|
|
20483
20562
|
console.log("No more unresolved line comments. Cache dropped.");
|
|
@@ -20507,8 +20586,8 @@ function resolveThread(threadId) {
|
|
|
20507
20586
|
unlinkSync14(queryFile);
|
|
20508
20587
|
}
|
|
20509
20588
|
}
|
|
20510
|
-
function requireCache(prNumber) {
|
|
20511
|
-
const cache4 = loadCommentsCache(prNumber);
|
|
20589
|
+
function requireCache(org, repo, prNumber) {
|
|
20590
|
+
const cache4 = loadCommentsCache(org, repo, prNumber);
|
|
20512
20591
|
if (!cache4) {
|
|
20513
20592
|
console.error(
|
|
20514
20593
|
`Error: No cached comments found for PR #${prNumber}. Run "assist prs list-comments" first.`
|
|
@@ -20530,22 +20609,22 @@ function requireLineComment(cache4, commentId) {
|
|
|
20530
20609
|
}
|
|
20531
20610
|
return comment3;
|
|
20532
20611
|
}
|
|
20533
|
-
function cleanupCacheIfDone(cache4, prNumber, commentId) {
|
|
20612
|
+
function cleanupCacheIfDone(cache4, org, repo, prNumber, commentId) {
|
|
20534
20613
|
const hasRemaining = cache4.comments.some(
|
|
20535
20614
|
(c) => c.type === "line" && c.id !== commentId
|
|
20536
20615
|
);
|
|
20537
|
-
if (!hasRemaining) deleteCommentsCache(prNumber);
|
|
20616
|
+
if (!hasRemaining) deleteCommentsCache(org, repo, prNumber);
|
|
20538
20617
|
}
|
|
20539
20618
|
function resolveCommentWithReply(commentId, message2) {
|
|
20540
20619
|
const prNumber = getCurrentPrNumber();
|
|
20541
20620
|
const { org, repo } = getRepoInfo();
|
|
20542
|
-
const cache4 = requireCache(prNumber);
|
|
20621
|
+
const cache4 = requireCache(org, repo, prNumber);
|
|
20543
20622
|
const comment3 = requireLineComment(cache4, commentId);
|
|
20544
20623
|
replyToComment(org, repo, prNumber, commentId, message2);
|
|
20545
20624
|
console.log("Reply posted successfully.");
|
|
20546
20625
|
resolveThread(comment3.threadId);
|
|
20547
20626
|
console.log("Thread resolved successfully.");
|
|
20548
|
-
cleanupCacheIfDone(cache4, prNumber, commentId);
|
|
20627
|
+
cleanupCacheIfDone(cache4, org, repo, prNumber, commentId);
|
|
20549
20628
|
}
|
|
20550
20629
|
|
|
20551
20630
|
// src/commands/prs/fixed.ts
|
|
@@ -20577,11 +20656,6 @@ function fixed(commentId, sha) {
|
|
|
20577
20656
|
}
|
|
20578
20657
|
}
|
|
20579
20658
|
|
|
20580
|
-
// src/commands/prs/listComments/index.ts
|
|
20581
|
-
import { existsSync as existsSync48, mkdirSync as mkdirSync18, writeFileSync as writeFileSync35 } from "fs";
|
|
20582
|
-
import { join as join57 } from "path";
|
|
20583
|
-
import { stringify } from "yaml";
|
|
20584
|
-
|
|
20585
20659
|
// src/commands/prs/fetchThreadIds.ts
|
|
20586
20660
|
import { execSync as execSync46 } from "child_process";
|
|
20587
20661
|
import { unlinkSync as unlinkSync15, writeFileSync as writeFileSync34 } from "fs";
|
|
@@ -20657,6 +20731,28 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
20657
20731
|
);
|
|
20658
20732
|
}
|
|
20659
20733
|
|
|
20734
|
+
// src/commands/prs/listComments/updateCommentsCache.ts
|
|
20735
|
+
import { mkdirSync as mkdirSync18, writeFileSync as writeFileSync35 } from "fs";
|
|
20736
|
+
import { dirname as dirname27 } from "path";
|
|
20737
|
+
import { stringify } from "yaml";
|
|
20738
|
+
function writeCommentsCache(org, repo, prNumber, comments3) {
|
|
20739
|
+
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
20740
|
+
mkdirSync18(dirname27(cachePath), { recursive: true });
|
|
20741
|
+
const cacheData = {
|
|
20742
|
+
prNumber,
|
|
20743
|
+
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
20744
|
+
comments: comments3
|
|
20745
|
+
};
|
|
20746
|
+
writeFileSync35(cachePath, stringify(cacheData));
|
|
20747
|
+
}
|
|
20748
|
+
function updateCommentsCache(org, repo, prNumber, comments3) {
|
|
20749
|
+
if (comments3.some((c) => c.type === "line")) {
|
|
20750
|
+
writeCommentsCache(org, repo, prNumber, comments3);
|
|
20751
|
+
} else {
|
|
20752
|
+
deleteCommentsCache(org, repo, prNumber);
|
|
20753
|
+
}
|
|
20754
|
+
}
|
|
20755
|
+
|
|
20660
20756
|
// src/commands/prs/listComments/printComments.ts
|
|
20661
20757
|
import chalk167 from "chalk";
|
|
20662
20758
|
function formatForHuman(comment3) {
|
|
@@ -20702,19 +20798,6 @@ function printComments2(result) {
|
|
|
20702
20798
|
}
|
|
20703
20799
|
|
|
20704
20800
|
// src/commands/prs/listComments/index.ts
|
|
20705
|
-
function writeCommentsCache(prNumber, comments3) {
|
|
20706
|
-
const assistDir = join57(process.cwd(), ".assist");
|
|
20707
|
-
if (!existsSync48(assistDir)) {
|
|
20708
|
-
mkdirSync18(assistDir, { recursive: true });
|
|
20709
|
-
}
|
|
20710
|
-
const cacheData = {
|
|
20711
|
-
prNumber,
|
|
20712
|
-
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
20713
|
-
comments: comments3
|
|
20714
|
-
};
|
|
20715
|
-
const cachePath = join57(assistDir, `pr-${prNumber}-comments.yaml`);
|
|
20716
|
-
writeFileSync35(cachePath, stringify(cacheData));
|
|
20717
|
-
}
|
|
20718
20801
|
function handleKnownErrors(error) {
|
|
20719
20802
|
if (isGhNotInstalled(error)) {
|
|
20720
20803
|
console.error("Error: GitHub CLI (gh) is not installed.");
|
|
@@ -20727,13 +20810,6 @@ function handleKnownErrors(error) {
|
|
|
20727
20810
|
}
|
|
20728
20811
|
return null;
|
|
20729
20812
|
}
|
|
20730
|
-
function updateCache(prNumber, comments3) {
|
|
20731
|
-
if (comments3.some((c) => c.type === "line")) {
|
|
20732
|
-
writeCommentsCache(prNumber, comments3);
|
|
20733
|
-
} else {
|
|
20734
|
-
deleteCommentsCache(prNumber);
|
|
20735
|
-
}
|
|
20736
|
-
}
|
|
20737
20813
|
async function listComments() {
|
|
20738
20814
|
try {
|
|
20739
20815
|
const prNumber = getCurrentPrNumber();
|
|
@@ -20743,9 +20819,9 @@ async function listComments() {
|
|
|
20743
20819
|
...fetchReviewComments(org, repo, prNumber),
|
|
20744
20820
|
...fetchLineComments(org, repo, prNumber, threadInfo)
|
|
20745
20821
|
];
|
|
20746
|
-
|
|
20822
|
+
updateCommentsCache(org, repo, prNumber, allComments);
|
|
20747
20823
|
const hasLineComments = allComments.some((c) => c.type === "line");
|
|
20748
|
-
const cachePath = hasLineComments ?
|
|
20824
|
+
const cachePath = hasLineComments ? commentsCachePath(org, repo, prNumber) : null;
|
|
20749
20825
|
return { comments: allComments, cachePath };
|
|
20750
20826
|
} catch (error) {
|
|
20751
20827
|
const handled = handleKnownErrors(error);
|
|
@@ -23536,11 +23612,11 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
23536
23612
|
}
|
|
23537
23613
|
|
|
23538
23614
|
// src/commands/review/buildReviewPaths.ts
|
|
23539
|
-
import { homedir as
|
|
23540
|
-
import { basename as basename14, join as
|
|
23615
|
+
import { homedir as homedir21 } from "os";
|
|
23616
|
+
import { basename as basename14, join as join57 } from "path";
|
|
23541
23617
|
function buildReviewPaths(repoRoot, key) {
|
|
23542
|
-
const reviewDir =
|
|
23543
|
-
|
|
23618
|
+
const reviewDir = join57(
|
|
23619
|
+
homedir21(),
|
|
23544
23620
|
".assist",
|
|
23545
23621
|
"reviews",
|
|
23546
23622
|
basename14(repoRoot),
|
|
@@ -23548,10 +23624,10 @@ function buildReviewPaths(repoRoot, key) {
|
|
|
23548
23624
|
);
|
|
23549
23625
|
return {
|
|
23550
23626
|
reviewDir,
|
|
23551
|
-
requestPath:
|
|
23552
|
-
claudePath:
|
|
23553
|
-
codexPath:
|
|
23554
|
-
synthesisPath:
|
|
23627
|
+
requestPath: join57(reviewDir, "request.md"),
|
|
23628
|
+
claudePath: join57(reviewDir, "claude.md"),
|
|
23629
|
+
codexPath: join57(reviewDir, "codex.md"),
|
|
23630
|
+
synthesisPath: join57(reviewDir, "synthesis.md")
|
|
23555
23631
|
};
|
|
23556
23632
|
}
|
|
23557
23633
|
|
|
@@ -24090,10 +24166,10 @@ async function handlePostSynthesis(synthesisPath, options2) {
|
|
|
24090
24166
|
}
|
|
24091
24167
|
|
|
24092
24168
|
// src/commands/review/prepareReviewDir.ts
|
|
24093
|
-
import { existsSync as
|
|
24169
|
+
import { existsSync as existsSync48, mkdirSync as mkdirSync19, unlinkSync as unlinkSync16, writeFileSync as writeFileSync36 } from "fs";
|
|
24094
24170
|
function clearReviewFiles(paths) {
|
|
24095
24171
|
for (const path71 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
24096
|
-
if (
|
|
24172
|
+
if (existsSync48(path71)) unlinkSync16(path71);
|
|
24097
24173
|
}
|
|
24098
24174
|
}
|
|
24099
24175
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -24378,7 +24454,7 @@ function printReviewerFailures(results) {
|
|
|
24378
24454
|
}
|
|
24379
24455
|
|
|
24380
24456
|
// src/commands/review/runAndSynthesise.ts
|
|
24381
|
-
import { existsSync as
|
|
24457
|
+
import { existsSync as existsSync50, unlinkSync as unlinkSync18 } from "fs";
|
|
24382
24458
|
|
|
24383
24459
|
// src/commands/review/buildReviewerStdin.ts
|
|
24384
24460
|
var REVIEW_PROMPT = `You are acting as a reviewer for a proposed code change made by another engineer. The full review request \u2014 branch, base, changed files, and unified diff \u2014 is in the request file whose absolute path is given below.
|
|
@@ -24798,7 +24874,7 @@ function resolveClaude(args) {
|
|
|
24798
24874
|
}
|
|
24799
24875
|
|
|
24800
24876
|
// src/commands/review/runCodexReviewer.ts
|
|
24801
|
-
import { existsSync as
|
|
24877
|
+
import { existsSync as existsSync49, unlinkSync as unlinkSync17 } from "fs";
|
|
24802
24878
|
|
|
24803
24879
|
// src/commands/review/parseCodexEvent.ts
|
|
24804
24880
|
function isItemStarted(value) {
|
|
@@ -24850,7 +24926,7 @@ async function runCodexReviewer(spec) {
|
|
|
24850
24926
|
reportReviewerToolUse(spec.name, event, spinner);
|
|
24851
24927
|
}
|
|
24852
24928
|
});
|
|
24853
|
-
if (result.exitCode !== 0 &&
|
|
24929
|
+
if (result.exitCode !== 0 && existsSync49(spec.outputPath)) {
|
|
24854
24930
|
unlinkSync17(spec.outputPath);
|
|
24855
24931
|
}
|
|
24856
24932
|
return finaliseReviewerRun({ ...spec, command }, spinner, result);
|
|
@@ -24996,7 +25072,7 @@ async function runAndSynthesise(args) {
|
|
|
24996
25072
|
console.error("Both reviewers failed; skipping synthesis.");
|
|
24997
25073
|
return { ok: false, failures };
|
|
24998
25074
|
}
|
|
24999
|
-
if (anyFresh &&
|
|
25075
|
+
if (anyFresh && existsSync50(paths.synthesisPath)) {
|
|
25000
25076
|
unlinkSync18(paths.synthesisPath);
|
|
25001
25077
|
}
|
|
25002
25078
|
const synthesisResult = await synthesise(paths, { multi });
|
|
@@ -25869,27 +25945,27 @@ async function configure() {
|
|
|
25869
25945
|
}
|
|
25870
25946
|
|
|
25871
25947
|
// src/commands/transcript/list.ts
|
|
25872
|
-
import { existsSync as
|
|
25873
|
-
import { join as
|
|
25948
|
+
import { existsSync as existsSync51, readdirSync as readdirSync10, statSync as statSync8 } from "fs";
|
|
25949
|
+
import { join as join58 } from "path";
|
|
25874
25950
|
function list4() {
|
|
25875
25951
|
const { vttDir } = getTranscriptConfig();
|
|
25876
|
-
if (!
|
|
25952
|
+
if (!existsSync51(vttDir)) return;
|
|
25877
25953
|
for (const entry of readdirSync10(vttDir)) {
|
|
25878
25954
|
if (!entry.endsWith(".vtt")) continue;
|
|
25879
|
-
if (statSync8(
|
|
25955
|
+
if (statSync8(join58(vttDir, entry)).isDirectory()) continue;
|
|
25880
25956
|
console.log(entry);
|
|
25881
25957
|
}
|
|
25882
25958
|
}
|
|
25883
25959
|
|
|
25884
25960
|
// src/commands/transcript/move.ts
|
|
25885
25961
|
import {
|
|
25886
|
-
existsSync as
|
|
25962
|
+
existsSync as existsSync52,
|
|
25887
25963
|
mkdirSync as mkdirSync20,
|
|
25888
25964
|
readFileSync as readFileSync42,
|
|
25889
25965
|
renameSync as renameSync2,
|
|
25890
25966
|
writeFileSync as writeFileSync38
|
|
25891
25967
|
} from "fs";
|
|
25892
|
-
import { basename as basename15, join as
|
|
25968
|
+
import { basename as basename15, join as join59 } from "path";
|
|
25893
25969
|
|
|
25894
25970
|
// src/commands/transcript/cleanText.ts
|
|
25895
25971
|
function cleanText(text17) {
|
|
@@ -26102,9 +26178,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
26102
26178
|
return formatChatLog(messages);
|
|
26103
26179
|
}
|
|
26104
26180
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
26105
|
-
const processedDir =
|
|
26181
|
+
const processedDir = join59(vttDir, "processed");
|
|
26106
26182
|
mkdirSync20(processedDir, { recursive: true });
|
|
26107
|
-
renameSync2(sourcePath,
|
|
26183
|
+
renameSync2(sourcePath, join59(processedDir, filename));
|
|
26108
26184
|
}
|
|
26109
26185
|
function move(file, options2) {
|
|
26110
26186
|
const { date, client } = options2;
|
|
@@ -26114,19 +26190,19 @@ function move(file, options2) {
|
|
|
26114
26190
|
}
|
|
26115
26191
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
26116
26192
|
const filename = basename15(file);
|
|
26117
|
-
const sourcePath =
|
|
26118
|
-
if (!
|
|
26193
|
+
const sourcePath = join59(vttDir, filename);
|
|
26194
|
+
if (!existsSync52(sourcePath)) {
|
|
26119
26195
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
26120
26196
|
process.exit(1);
|
|
26121
26197
|
}
|
|
26122
26198
|
const base = basename15(filename, ".vtt").replace(/ Transcription$/, "");
|
|
26123
26199
|
const outputName = `${date} ${base}.md`;
|
|
26124
|
-
const formattedDir =
|
|
26200
|
+
const formattedDir = join59(transcriptsDir, client);
|
|
26125
26201
|
mkdirSync20(formattedDir, { recursive: true });
|
|
26126
|
-
const formattedPath =
|
|
26202
|
+
const formattedPath = join59(formattedDir, outputName);
|
|
26127
26203
|
writeFileSync38(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
26128
26204
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
26129
|
-
const summaryPath =
|
|
26205
|
+
const summaryPath = join59(summaryDir, client, outputName);
|
|
26130
26206
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
26131
26207
|
console.log(`Summary target: ${summaryPath}`);
|
|
26132
26208
|
}
|
|
@@ -26246,45 +26322,45 @@ function registerVerify(program2) {
|
|
|
26246
26322
|
|
|
26247
26323
|
// src/commands/voice/devices.ts
|
|
26248
26324
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
26249
|
-
import { join as
|
|
26325
|
+
import { join as join61 } from "path";
|
|
26250
26326
|
|
|
26251
26327
|
// src/commands/voice/shared.ts
|
|
26252
|
-
import { homedir as
|
|
26253
|
-
import { dirname as
|
|
26328
|
+
import { homedir as homedir22 } from "os";
|
|
26329
|
+
import { dirname as dirname29, join as join60 } from "path";
|
|
26254
26330
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
26255
|
-
var __dirname5 =
|
|
26256
|
-
var VOICE_DIR =
|
|
26331
|
+
var __dirname5 = dirname29(fileURLToPath7(import.meta.url));
|
|
26332
|
+
var VOICE_DIR = join60(homedir22(), ".assist", "voice");
|
|
26257
26333
|
var voicePaths = {
|
|
26258
26334
|
dir: VOICE_DIR,
|
|
26259
|
-
pid:
|
|
26260
|
-
log:
|
|
26261
|
-
venv:
|
|
26262
|
-
lock:
|
|
26335
|
+
pid: join60(VOICE_DIR, "voice.pid"),
|
|
26336
|
+
log: join60(VOICE_DIR, "voice.log"),
|
|
26337
|
+
venv: join60(VOICE_DIR, ".venv"),
|
|
26338
|
+
lock: join60(VOICE_DIR, "voice.lock")
|
|
26263
26339
|
};
|
|
26264
26340
|
function getPythonDir() {
|
|
26265
|
-
return
|
|
26341
|
+
return join60(__dirname5, "commands", "voice", "python");
|
|
26266
26342
|
}
|
|
26267
26343
|
function getVenvPython() {
|
|
26268
|
-
return process.platform === "win32" ?
|
|
26344
|
+
return process.platform === "win32" ? join60(voicePaths.venv, "Scripts", "python.exe") : join60(voicePaths.venv, "bin", "python");
|
|
26269
26345
|
}
|
|
26270
26346
|
function getLockDir() {
|
|
26271
26347
|
const config = loadConfig();
|
|
26272
26348
|
return config.voice?.lockDir ?? VOICE_DIR;
|
|
26273
26349
|
}
|
|
26274
26350
|
function getLockFile() {
|
|
26275
|
-
return
|
|
26351
|
+
return join60(getLockDir(), "voice.lock");
|
|
26276
26352
|
}
|
|
26277
26353
|
|
|
26278
26354
|
// src/commands/voice/devices.ts
|
|
26279
26355
|
function devices() {
|
|
26280
|
-
const script =
|
|
26356
|
+
const script = join61(getPythonDir(), "list_devices.py");
|
|
26281
26357
|
spawnSync6(getVenvPython(), [script], { stdio: "inherit" });
|
|
26282
26358
|
}
|
|
26283
26359
|
|
|
26284
26360
|
// src/commands/voice/logs.ts
|
|
26285
|
-
import { existsSync as
|
|
26361
|
+
import { existsSync as existsSync53, readFileSync as readFileSync43 } from "fs";
|
|
26286
26362
|
function logs(options2) {
|
|
26287
|
-
if (!
|
|
26363
|
+
if (!existsSync53(voicePaths.log)) {
|
|
26288
26364
|
console.log("No voice log file found");
|
|
26289
26365
|
return;
|
|
26290
26366
|
}
|
|
@@ -26312,12 +26388,12 @@ function logs(options2) {
|
|
|
26312
26388
|
// src/commands/voice/setup.ts
|
|
26313
26389
|
import { spawnSync as spawnSync7 } from "child_process";
|
|
26314
26390
|
import { mkdirSync as mkdirSync22 } from "fs";
|
|
26315
|
-
import { join as
|
|
26391
|
+
import { join as join63 } from "path";
|
|
26316
26392
|
|
|
26317
26393
|
// src/commands/voice/checkLockFile.ts
|
|
26318
26394
|
import { execSync as execSync58 } from "child_process";
|
|
26319
|
-
import { existsSync as
|
|
26320
|
-
import { join as
|
|
26395
|
+
import { existsSync as existsSync54, mkdirSync as mkdirSync21, readFileSync as readFileSync44, writeFileSync as writeFileSync39 } from "fs";
|
|
26396
|
+
import { join as join62 } from "path";
|
|
26321
26397
|
function isProcessAlive2(pid) {
|
|
26322
26398
|
try {
|
|
26323
26399
|
process.kill(pid, 0);
|
|
@@ -26328,7 +26404,7 @@ function isProcessAlive2(pid) {
|
|
|
26328
26404
|
}
|
|
26329
26405
|
function checkLockFile() {
|
|
26330
26406
|
const lockFile = getLockFile();
|
|
26331
|
-
if (!
|
|
26407
|
+
if (!existsSync54(lockFile)) return;
|
|
26332
26408
|
try {
|
|
26333
26409
|
const lock2 = JSON.parse(readFileSync44(lockFile, "utf8"));
|
|
26334
26410
|
if (lock2.pid && isProcessAlive2(lock2.pid)) {
|
|
@@ -26341,7 +26417,7 @@ function checkLockFile() {
|
|
|
26341
26417
|
}
|
|
26342
26418
|
}
|
|
26343
26419
|
function bootstrapVenv() {
|
|
26344
|
-
if (
|
|
26420
|
+
if (existsSync54(getVenvPython())) return;
|
|
26345
26421
|
console.log("Setting up Python environment...");
|
|
26346
26422
|
const pythonDir = getPythonDir();
|
|
26347
26423
|
execSync58(
|
|
@@ -26354,7 +26430,7 @@ function bootstrapVenv() {
|
|
|
26354
26430
|
}
|
|
26355
26431
|
function writeLockFile(pid) {
|
|
26356
26432
|
const lockFile = getLockFile();
|
|
26357
|
-
mkdirSync21(
|
|
26433
|
+
mkdirSync21(join62(lockFile, ".."), { recursive: true });
|
|
26358
26434
|
writeFileSync39(
|
|
26359
26435
|
lockFile,
|
|
26360
26436
|
JSON.stringify({
|
|
@@ -26370,7 +26446,7 @@ function setup() {
|
|
|
26370
26446
|
mkdirSync22(voicePaths.dir, { recursive: true });
|
|
26371
26447
|
bootstrapVenv();
|
|
26372
26448
|
console.log("\nDownloading models...\n");
|
|
26373
|
-
const script =
|
|
26449
|
+
const script = join63(getPythonDir(), "setup_models.py");
|
|
26374
26450
|
const result = spawnSync7(getVenvPython(), [script], {
|
|
26375
26451
|
stdio: "inherit",
|
|
26376
26452
|
env: { ...process.env, VOICE_LOG_FILE: voicePaths.log }
|
|
@@ -26384,7 +26460,7 @@ function setup() {
|
|
|
26384
26460
|
// src/commands/voice/start.ts
|
|
26385
26461
|
import { spawn as spawn8 } from "child_process";
|
|
26386
26462
|
import { mkdirSync as mkdirSync23, writeFileSync as writeFileSync40 } from "fs";
|
|
26387
|
-
import { join as
|
|
26463
|
+
import { join as join64 } from "path";
|
|
26388
26464
|
|
|
26389
26465
|
// src/commands/voice/buildDaemonEnv.ts
|
|
26390
26466
|
function buildDaemonEnv(options2) {
|
|
@@ -26422,7 +26498,7 @@ function start2(options2) {
|
|
|
26422
26498
|
bootstrapVenv();
|
|
26423
26499
|
const debug = options2.debug || options2.foreground || process.platform === "win32";
|
|
26424
26500
|
const env = buildDaemonEnv({ debug });
|
|
26425
|
-
const script =
|
|
26501
|
+
const script = join64(getPythonDir(), "voice_daemon.py");
|
|
26426
26502
|
const python = getVenvPython();
|
|
26427
26503
|
if (options2.foreground) {
|
|
26428
26504
|
spawnForeground(python, script, env);
|
|
@@ -26432,7 +26508,7 @@ function start2(options2) {
|
|
|
26432
26508
|
}
|
|
26433
26509
|
|
|
26434
26510
|
// src/commands/voice/status.ts
|
|
26435
|
-
import { existsSync as
|
|
26511
|
+
import { existsSync as existsSync55, readFileSync as readFileSync45 } from "fs";
|
|
26436
26512
|
function isProcessAlive3(pid) {
|
|
26437
26513
|
try {
|
|
26438
26514
|
process.kill(pid, 0);
|
|
@@ -26442,12 +26518,12 @@ function isProcessAlive3(pid) {
|
|
|
26442
26518
|
}
|
|
26443
26519
|
}
|
|
26444
26520
|
function readRecentLogs(count8) {
|
|
26445
|
-
if (!
|
|
26521
|
+
if (!existsSync55(voicePaths.log)) return [];
|
|
26446
26522
|
const lines = readFileSync45(voicePaths.log, "utf8").trim().split("\n");
|
|
26447
26523
|
return lines.slice(-count8);
|
|
26448
26524
|
}
|
|
26449
26525
|
function status2() {
|
|
26450
|
-
if (!
|
|
26526
|
+
if (!existsSync55(voicePaths.pid)) {
|
|
26451
26527
|
console.log("Voice daemon: not running (no PID file)");
|
|
26452
26528
|
return;
|
|
26453
26529
|
}
|
|
@@ -26470,9 +26546,9 @@ function status2() {
|
|
|
26470
26546
|
}
|
|
26471
26547
|
|
|
26472
26548
|
// src/commands/voice/stop.ts
|
|
26473
|
-
import { existsSync as
|
|
26549
|
+
import { existsSync as existsSync56, readFileSync as readFileSync46, unlinkSync as unlinkSync19 } from "fs";
|
|
26474
26550
|
function stop2() {
|
|
26475
|
-
if (!
|
|
26551
|
+
if (!existsSync56(voicePaths.pid)) {
|
|
26476
26552
|
console.log("Voice daemon is not running (no PID file)");
|
|
26477
26553
|
return;
|
|
26478
26554
|
}
|
|
@@ -26489,7 +26565,7 @@ function stop2() {
|
|
|
26489
26565
|
}
|
|
26490
26566
|
try {
|
|
26491
26567
|
const lockFile = getLockFile();
|
|
26492
|
-
if (
|
|
26568
|
+
if (existsSync56(lockFile)) unlinkSync19(lockFile);
|
|
26493
26569
|
} catch {
|
|
26494
26570
|
}
|
|
26495
26571
|
console.log("Voice daemon stopped");
|
|
@@ -26950,7 +27026,7 @@ async function auth() {
|
|
|
26950
27026
|
// src/commands/roam/postRoamActivity.ts
|
|
26951
27027
|
import { execFileSync as execFileSync12 } from "child_process";
|
|
26952
27028
|
import { readdirSync as readdirSync11, readFileSync as readFileSync47, statSync as statSync9 } from "fs";
|
|
26953
|
-
import { join as
|
|
27029
|
+
import { join as join65 } from "path";
|
|
26954
27030
|
function findPortFile(roamDir) {
|
|
26955
27031
|
let entries;
|
|
26956
27032
|
try {
|
|
@@ -26959,7 +27035,7 @@ function findPortFile(roamDir) {
|
|
|
26959
27035
|
return void 0;
|
|
26960
27036
|
}
|
|
26961
27037
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
26962
|
-
const path71 =
|
|
27038
|
+
const path71 = join65(roamDir, name);
|
|
26963
27039
|
try {
|
|
26964
27040
|
return { path: path71, mtimeMs: statSync9(path71).mtimeMs };
|
|
26965
27041
|
} catch {
|
|
@@ -26971,7 +27047,7 @@ function findPortFile(roamDir) {
|
|
|
26971
27047
|
function postRoamActivity(app, event) {
|
|
26972
27048
|
const appData = process.env.APPDATA;
|
|
26973
27049
|
if (!appData) return;
|
|
26974
|
-
const portFile = findPortFile(
|
|
27050
|
+
const portFile = findPortFile(join65(appData, "Roam"));
|
|
26975
27051
|
if (!portFile) return;
|
|
26976
27052
|
let port;
|
|
26977
27053
|
try {
|
|
@@ -27203,15 +27279,15 @@ function runPreCommands(pre, cwd) {
|
|
|
27203
27279
|
|
|
27204
27280
|
// src/commands/run/spawnRunCommand.ts
|
|
27205
27281
|
import { execFileSync as execFileSync13, spawn as spawn9 } from "child_process";
|
|
27206
|
-
import { existsSync as
|
|
27207
|
-
import { dirname as
|
|
27282
|
+
import { existsSync as existsSync57 } from "fs";
|
|
27283
|
+
import { dirname as dirname30, join as join66, resolve as resolve15 } from "path";
|
|
27208
27284
|
function resolveCommand2(command) {
|
|
27209
27285
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
27210
27286
|
try {
|
|
27211
27287
|
const gitPath = execFileSync13("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
27212
|
-
const gitRoot = resolve15(
|
|
27213
|
-
const gitBash =
|
|
27214
|
-
if (
|
|
27288
|
+
const gitRoot = resolve15(dirname30(gitPath), "..");
|
|
27289
|
+
const gitBash = join66(gitRoot, "bin", "bash.exe");
|
|
27290
|
+
if (existsSync57(gitBash)) return gitBash;
|
|
27215
27291
|
} catch {
|
|
27216
27292
|
}
|
|
27217
27293
|
return command;
|
|
@@ -27299,7 +27375,7 @@ async function run3(name, args) {
|
|
|
27299
27375
|
|
|
27300
27376
|
// src/commands/run/add.ts
|
|
27301
27377
|
import { mkdirSync as mkdirSync24, writeFileSync as writeFileSync41 } from "fs";
|
|
27302
|
-
import { join as
|
|
27378
|
+
import { join as join67 } from "path";
|
|
27303
27379
|
|
|
27304
27380
|
// src/commands/run/extractOption.ts
|
|
27305
27381
|
function extractOption(args, flag) {
|
|
@@ -27360,7 +27436,7 @@ function saveNewRunConfig(name, command, args, cwd) {
|
|
|
27360
27436
|
saveConfig(config);
|
|
27361
27437
|
}
|
|
27362
27438
|
function createCommandFile(name) {
|
|
27363
|
-
const dir =
|
|
27439
|
+
const dir = join67(".claude", "commands");
|
|
27364
27440
|
mkdirSync24(dir, { recursive: true });
|
|
27365
27441
|
const content = `---
|
|
27366
27442
|
description: Run ${name}
|
|
@@ -27368,7 +27444,7 @@ description: Run ${name}
|
|
|
27368
27444
|
|
|
27369
27445
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
27370
27446
|
`;
|
|
27371
|
-
const filePath =
|
|
27447
|
+
const filePath = join67(dir, `${name}.md`);
|
|
27372
27448
|
writeFileSync41(filePath, content);
|
|
27373
27449
|
console.log(`Created command file: ${filePath}`);
|
|
27374
27450
|
}
|
|
@@ -27424,8 +27500,8 @@ function link2() {
|
|
|
27424
27500
|
}
|
|
27425
27501
|
|
|
27426
27502
|
// src/commands/run/remove.ts
|
|
27427
|
-
import { existsSync as
|
|
27428
|
-
import { join as
|
|
27503
|
+
import { existsSync as existsSync58, unlinkSync as unlinkSync20 } from "fs";
|
|
27504
|
+
import { join as join68 } from "path";
|
|
27429
27505
|
function findRemoveIndex() {
|
|
27430
27506
|
const idx = process.argv.indexOf("remove");
|
|
27431
27507
|
if (idx === -1 || idx + 1 >= process.argv.length) return -1;
|
|
@@ -27440,8 +27516,8 @@ function parseRemoveName() {
|
|
|
27440
27516
|
return process.argv[idx + 1];
|
|
27441
27517
|
}
|
|
27442
27518
|
function deleteCommandFile(name) {
|
|
27443
|
-
const filePath =
|
|
27444
|
-
if (
|
|
27519
|
+
const filePath = join68(".claude", "commands", `${name}.md`);
|
|
27520
|
+
if (existsSync58(filePath)) {
|
|
27445
27521
|
unlinkSync20(filePath);
|
|
27446
27522
|
console.log(`Deleted command file: ${filePath}`);
|
|
27447
27523
|
}
|
|
@@ -27495,9 +27571,9 @@ function registerRun(program2) {
|
|
|
27495
27571
|
|
|
27496
27572
|
// src/commands/screenshot/index.ts
|
|
27497
27573
|
import { execSync as execSync60 } from "child_process";
|
|
27498
|
-
import { existsSync as
|
|
27574
|
+
import { existsSync as existsSync59, mkdirSync as mkdirSync25, unlinkSync as unlinkSync21, writeFileSync as writeFileSync42 } from "fs";
|
|
27499
27575
|
import { tmpdir as tmpdir8 } from "os";
|
|
27500
|
-
import { join as
|
|
27576
|
+
import { join as join69, resolve as resolve17 } from "path";
|
|
27501
27577
|
import chalk209 from "chalk";
|
|
27502
27578
|
|
|
27503
27579
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -27627,14 +27703,14 @@ Write-Output $OutputPath
|
|
|
27627
27703
|
|
|
27628
27704
|
// src/commands/screenshot/index.ts
|
|
27629
27705
|
function buildOutputPath(outputDir, processName) {
|
|
27630
|
-
if (!
|
|
27706
|
+
if (!existsSync59(outputDir)) {
|
|
27631
27707
|
mkdirSync25(outputDir, { recursive: true });
|
|
27632
27708
|
}
|
|
27633
27709
|
const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
27634
27710
|
return resolve17(outputDir, `${processName}-${timestamp6}.png`);
|
|
27635
27711
|
}
|
|
27636
27712
|
function runPowerShellScript(processName, outputPath) {
|
|
27637
|
-
const scriptPath =
|
|
27713
|
+
const scriptPath = join69(tmpdir8(), `assist-screenshot-${Date.now()}.ps1`);
|
|
27638
27714
|
writeFileSync42(scriptPath, captureWindowPs1, "utf8");
|
|
27639
27715
|
try {
|
|
27640
27716
|
execSync60(
|
|
@@ -28119,7 +28195,7 @@ function readDesignSystemPrompt() {
|
|
|
28119
28195
|
import * as pty from "node-pty";
|
|
28120
28196
|
|
|
28121
28197
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
28122
|
-
import { chmodSync, existsSync as
|
|
28198
|
+
import { chmodSync, existsSync as existsSync60, statSync as statSync10 } from "fs";
|
|
28123
28199
|
import { createRequire as createRequire3 } from "module";
|
|
28124
28200
|
import path59 from "path";
|
|
28125
28201
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -28134,7 +28210,7 @@ function ensureSpawnHelperExecutable() {
|
|
|
28134
28210
|
`${process.platform}-${process.arch}`,
|
|
28135
28211
|
"spawn-helper"
|
|
28136
28212
|
);
|
|
28137
|
-
if (!
|
|
28213
|
+
if (!existsSync60(helper)) return;
|
|
28138
28214
|
const mode = statSync10(helper).mode;
|
|
28139
28215
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
28140
28216
|
}
|
|
@@ -28294,17 +28370,17 @@ function otherTreeHolders(sessions, session) {
|
|
|
28294
28370
|
}
|
|
28295
28371
|
|
|
28296
28372
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
28297
|
-
import { existsSync as
|
|
28373
|
+
import { existsSync as existsSync62 } from "fs";
|
|
28298
28374
|
import { basename as basename16 } from "path";
|
|
28299
28375
|
|
|
28300
28376
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
28301
|
-
import { existsSync as
|
|
28302
|
-
import { join as
|
|
28377
|
+
import { existsSync as existsSync61 } from "fs";
|
|
28378
|
+
import { join as join72 } from "path";
|
|
28303
28379
|
|
|
28304
28380
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
28305
28381
|
import { statSync as statSync11 } from "fs";
|
|
28306
28382
|
import { rm as rm2 } from "fs/promises";
|
|
28307
|
-
import { join as
|
|
28383
|
+
import { join as join71 } from "path";
|
|
28308
28384
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
28309
28385
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
28310
28386
|
daemonLog(
|
|
@@ -28331,7 +28407,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
28331
28407
|
return true;
|
|
28332
28408
|
}
|
|
28333
28409
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
28334
|
-
return statSync11(
|
|
28410
|
+
return statSync11(join71(worktreePath, ".git"), {
|
|
28335
28411
|
throwIfNoEntry: false
|
|
28336
28412
|
})?.isDirectory() === true;
|
|
28337
28413
|
}
|
|
@@ -28367,7 +28443,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
28367
28443
|
);
|
|
28368
28444
|
}
|
|
28369
28445
|
function strandedReason(worktreePath, cause) {
|
|
28370
|
-
if (!
|
|
28446
|
+
if (!existsSync61(join72(worktreePath, ".git")))
|
|
28371
28447
|
return "its .git link is already gone";
|
|
28372
28448
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
28373
28449
|
return "git no longer recognises it as a working tree";
|
|
@@ -28419,7 +28495,7 @@ function reason3(error) {
|
|
|
28419
28495
|
|
|
28420
28496
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
28421
28497
|
async function reapWorktree(worktreePath, force = false) {
|
|
28422
|
-
if (!
|
|
28498
|
+
if (!existsSync62(worktreePath)) {
|
|
28423
28499
|
daemonLog(`worktree ${worktreePath} already gone; skipping reap`);
|
|
28424
28500
|
return false;
|
|
28425
28501
|
}
|
|
@@ -28440,7 +28516,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
28440
28516
|
}
|
|
28441
28517
|
function owningClone(worktreePath) {
|
|
28442
28518
|
const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
|
|
28443
|
-
if (recorded &&
|
|
28519
|
+
if (recorded && existsSync62(recorded)) return recorded;
|
|
28444
28520
|
const detected = mainWorktree(worktreePath);
|
|
28445
28521
|
if (detected) return detected;
|
|
28446
28522
|
daemonLog(
|
|
@@ -28527,12 +28603,12 @@ function setStatus2(session, newStatus) {
|
|
|
28527
28603
|
}
|
|
28528
28604
|
|
|
28529
28605
|
// src/commands/sessions/daemon/worktree/watchGitState.ts
|
|
28530
|
-
import { existsSync as
|
|
28606
|
+
import { existsSync as existsSync63, watch } from "fs";
|
|
28531
28607
|
var DEBOUNCE_MS = 500;
|
|
28532
28608
|
var POLL_MS = 3e4;
|
|
28533
28609
|
function watchGitState(cwd, onChange) {
|
|
28534
28610
|
const common = gitCommonDir(cwd);
|
|
28535
|
-
if (!common || !
|
|
28611
|
+
if (!common || !existsSync63(common)) return void 0;
|
|
28536
28612
|
const watchers = [
|
|
28537
28613
|
watchGitDir(common, onChange),
|
|
28538
28614
|
pollGitState(cwd, onChange)
|
|
@@ -28936,10 +29012,10 @@ function emitSessionOutput(session, clients, data) {
|
|
|
28936
29012
|
}
|
|
28937
29013
|
|
|
28938
29014
|
// src/commands/sessions/daemon/exitReason.ts
|
|
28939
|
-
import { existsSync as
|
|
29015
|
+
import { existsSync as existsSync64 } from "fs";
|
|
28940
29016
|
function exitReason(session, exitCode) {
|
|
28941
29017
|
const base = `process exited with code ${exitCode}`;
|
|
28942
|
-
if (session.cwd && !
|
|
29018
|
+
if (session.cwd && !existsSync64(session.cwd))
|
|
28943
29019
|
return `${base}: working directory ${session.cwd} no longer exists`;
|
|
28944
29020
|
return base;
|
|
28945
29021
|
}
|
|
@@ -28957,8 +29033,8 @@ function handleFailedResume(session, exitCode, onStatusChange) {
|
|
|
28957
29033
|
}
|
|
28958
29034
|
|
|
28959
29035
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
28960
|
-
import { existsSync as
|
|
28961
|
-
import { dirname as
|
|
29036
|
+
import { existsSync as existsSync65, mkdirSync as mkdirSync26, watch as watch2 } from "fs";
|
|
29037
|
+
import { dirname as dirname32 } from "path";
|
|
28962
29038
|
|
|
28963
29039
|
// src/commands/sessions/daemon/applyReviewPause.ts
|
|
28964
29040
|
function applyReviewPause(session, activity2) {
|
|
@@ -29012,7 +29088,7 @@ var DEBOUNCE_MS2 = 50;
|
|
|
29012
29088
|
function watchActivity(session, notify2, onClaudeSessionId) {
|
|
29013
29089
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
29014
29090
|
const path71 = activityPath(session.id);
|
|
29015
|
-
const dir =
|
|
29091
|
+
const dir = dirname32(path71);
|
|
29016
29092
|
try {
|
|
29017
29093
|
mkdirSync26(dir, { recursive: true });
|
|
29018
29094
|
} catch {
|
|
@@ -29038,7 +29114,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
29038
29114
|
if (timer) clearTimeout(timer);
|
|
29039
29115
|
timer = setTimeout(read, DEBOUNCE_MS2);
|
|
29040
29116
|
});
|
|
29041
|
-
if (
|
|
29117
|
+
if (existsSync65(path71)) read();
|
|
29042
29118
|
}
|
|
29043
29119
|
function refreshActivity(session) {
|
|
29044
29120
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -30127,7 +30203,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
30127
30203
|
}
|
|
30128
30204
|
|
|
30129
30205
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
30130
|
-
import { existsSync as
|
|
30206
|
+
import { existsSync as existsSync68 } from "fs";
|
|
30131
30207
|
import { basename as basename18 } from "path";
|
|
30132
30208
|
|
|
30133
30209
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
@@ -30217,9 +30293,9 @@ function capped(lines) {
|
|
|
30217
30293
|
}
|
|
30218
30294
|
|
|
30219
30295
|
// src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
|
|
30220
|
-
import { existsSync as
|
|
30296
|
+
import { existsSync as existsSync67 } from "fs";
|
|
30221
30297
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
30222
|
-
if (!
|
|
30298
|
+
if (!existsSync67(clone)) {
|
|
30223
30299
|
for (const { path: path71 } of paths) forgetWorktree(path71);
|
|
30224
30300
|
daemonLog(
|
|
30225
30301
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
@@ -30312,7 +30388,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
30312
30388
|
const vanished = /* @__PURE__ */ new Map();
|
|
30313
30389
|
for (const { path: path71, clone } of readWorktreeRegistry()) {
|
|
30314
30390
|
if (accounted.has(path71)) continue;
|
|
30315
|
-
if (!
|
|
30391
|
+
if (!existsSync68(path71)) {
|
|
30316
30392
|
vanished.set(clone, [
|
|
30317
30393
|
...vanished.get(clone) ?? [],
|
|
30318
30394
|
{ path: path71, branch: basename18(path71) }
|
|
@@ -30680,13 +30756,13 @@ async function defaultConnect() {
|
|
|
30680
30756
|
}
|
|
30681
30757
|
|
|
30682
30758
|
// src/commands/sessions/daemon/hasPersistedWindowsSessions.ts
|
|
30683
|
-
import { existsSync as
|
|
30759
|
+
import { existsSync as existsSync69, readFileSync as readFileSync50 } from "fs";
|
|
30684
30760
|
import { posix } from "path";
|
|
30685
30761
|
function hasPersistedWindowsSessions() {
|
|
30686
30762
|
const sessionsFile = windowsSessionsFileFromWsl();
|
|
30687
30763
|
if (!sessionsFile) return false;
|
|
30688
30764
|
try {
|
|
30689
|
-
if (!
|
|
30765
|
+
if (!existsSync69(sessionsFile)) return false;
|
|
30690
30766
|
const data = JSON.parse(readFileSync50(sessionsFile, "utf8"));
|
|
30691
30767
|
return Array.isArray(data) && data.length > 0;
|
|
30692
30768
|
} catch (error) {
|
|
@@ -31711,9 +31787,9 @@ function safeParse2(line) {
|
|
|
31711
31787
|
}
|
|
31712
31788
|
|
|
31713
31789
|
// src/commands/sessions/daemon/repoDirExists.ts
|
|
31714
|
-
import { existsSync as
|
|
31790
|
+
import { existsSync as existsSync70 } from "fs";
|
|
31715
31791
|
function repoDirExists(cwd) {
|
|
31716
|
-
return
|
|
31792
|
+
return existsSync70(toGitCwd(cwd));
|
|
31717
31793
|
}
|
|
31718
31794
|
|
|
31719
31795
|
// src/commands/sessions/daemon/withRepoGroups.ts
|
|
@@ -32334,9 +32410,9 @@ function buildLimitsSegment(rateLimits) {
|
|
|
32334
32410
|
|
|
32335
32411
|
// src/commands/readGitBranch.ts
|
|
32336
32412
|
import { readFileSync as readFileSync53, statSync as statSync13 } from "fs";
|
|
32337
|
-
import { isAbsolute as isAbsolute3, join as
|
|
32413
|
+
import { isAbsolute as isAbsolute3, join as join74, resolve as resolve18 } from "path";
|
|
32338
32414
|
function resolveGitDir(cwd) {
|
|
32339
|
-
const dotGit =
|
|
32415
|
+
const dotGit = join74(cwd, ".git");
|
|
32340
32416
|
let stat3;
|
|
32341
32417
|
try {
|
|
32342
32418
|
stat3 = statSync13(dotGit);
|
|
@@ -32366,7 +32442,7 @@ function readGitBranch(cwd) {
|
|
|
32366
32442
|
}
|
|
32367
32443
|
let head;
|
|
32368
32444
|
try {
|
|
32369
|
-
head = readFileSync53(
|
|
32445
|
+
head = readFileSync53(join74(gitDir, "HEAD"), "utf8");
|
|
32370
32446
|
} catch {
|
|
32371
32447
|
return null;
|
|
32372
32448
|
}
|