@staff0rd/assist 0.927.0 → 0.928.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/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.928.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -1554,15 +1554,15 @@ async function ensureTailscaleServe(port, deps2 = {}) {
|
|
|
1554
1554
|
if (!enabled()) return "skipped, sessions.tailscaleServe is false";
|
|
1555
1555
|
const current = await runningStatus(status2);
|
|
1556
1556
|
if (typeof current === "string") return current;
|
|
1557
|
-
for (let
|
|
1557
|
+
for (let attempt2 = 1; ; attempt2++) {
|
|
1558
1558
|
const plan2 = planServe(current, await serveStatus(), port, httpsPort(port));
|
|
1559
1559
|
if (plan2.alreadyServing) return `${plan2.url} already serves ${plan2.target}`;
|
|
1560
1560
|
try {
|
|
1561
1561
|
await serve(plan2.args);
|
|
1562
1562
|
return `serving ${plan2.target} at ${plan2.url}`;
|
|
1563
1563
|
} catch (error) {
|
|
1564
|
-
if (
|
|
1565
|
-
await sleep2(
|
|
1564
|
+
if (attempt2 >= SERVE_WRITE_ATTEMPTS) throw error;
|
|
1565
|
+
await sleep2(attempt2 * 500 + Math.random() * 500);
|
|
1566
1566
|
}
|
|
1567
1567
|
}
|
|
1568
1568
|
}
|
|
@@ -5220,7 +5220,12 @@ var prActions = [
|
|
|
5220
5220
|
];
|
|
5221
5221
|
|
|
5222
5222
|
// src/shared/azureDevops/azureDevopsPrActions.ts
|
|
5223
|
-
var SUPPORTED = /* @__PURE__ */ new Set([
|
|
5223
|
+
var SUPPORTED = /* @__PURE__ */ new Set([
|
|
5224
|
+
"Checkout",
|
|
5225
|
+
"Address Comments",
|
|
5226
|
+
"Address Comments (batch)",
|
|
5227
|
+
"Address Comments (auto)"
|
|
5228
|
+
]);
|
|
5224
5229
|
var azureDevopsPrActions = prActions.filter(
|
|
5225
5230
|
({ label: label2 }) => SUPPORTED.has(label2)
|
|
5226
5231
|
);
|
|
@@ -6521,7 +6526,7 @@ var sessionsConfigHelp = [
|
|
|
6521
6526
|
{
|
|
6522
6527
|
key: "worktree.install",
|
|
6523
6528
|
setter: "assist config set worktree.install true -g --repo",
|
|
6524
|
-
note: `per-worktree dep install: true auto-detects the package manager, or give an explicit command; false to skip; or a JSON list of paths (e.g. '[".","packages/ui"]') to auto-detect and install in each, in order, stopping at the first failure`
|
|
6529
|
+
note: `per-worktree dep install: true auto-detects the package manager (npm ci when a package-lock.json exists), or give an explicit command; false to skip; or a JSON list of paths (e.g. '[".","packages/ui"]') to auto-detect and install in each, in order, stopping at the first failure`
|
|
6525
6530
|
},
|
|
6526
6531
|
{
|
|
6527
6532
|
key: "worktree.commitBeforePhaseEnd",
|
|
@@ -17072,12 +17077,12 @@ function buildPayload(sessionId, status2, source, claudeSessionId) {
|
|
|
17072
17077
|
return payload;
|
|
17073
17078
|
}
|
|
17074
17079
|
async function deliver(sessionId, status2, payload, attempts) {
|
|
17075
|
-
for (let
|
|
17080
|
+
for (let attempt2 = 1; attempt2 <= attempts; attempt2++) {
|
|
17076
17081
|
try {
|
|
17077
17082
|
await sendToDaemonAwaitAck(payload);
|
|
17078
17083
|
return;
|
|
17079
17084
|
} catch (error) {
|
|
17080
|
-
if (
|
|
17085
|
+
if (attempt2 < attempts) {
|
|
17081
17086
|
await sleep(RETRY_DELAY_MS2);
|
|
17082
17087
|
continue;
|
|
17083
17088
|
}
|
|
@@ -27668,6 +27673,7 @@ function detectInstallCommand(dir) {
|
|
|
27668
27673
|
if (existsSync61(join72(dir, "pnpm-lock.yaml"))) return "pnpm install";
|
|
27669
27674
|
if (existsSync61(join72(dir, "yarn.lock"))) return "yarn install";
|
|
27670
27675
|
if (existsSync61(join72(dir, "bun.lockb"))) return "bun install";
|
|
27676
|
+
if (existsSync61(join72(dir, "package-lock.json"))) return "npm ci";
|
|
27671
27677
|
return "npm install";
|
|
27672
27678
|
}
|
|
27673
27679
|
|
|
@@ -29992,11 +29998,265 @@ function commentsCachePath(org, repo, prNumber) {
|
|
|
29992
29998
|
);
|
|
29993
29999
|
}
|
|
29994
30000
|
|
|
29995
|
-
// src/commands/prs/
|
|
30001
|
+
// src/commands/prs/listComments/updateCommentsCache.ts
|
|
30002
|
+
import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync36 } from "fs";
|
|
30003
|
+
import { dirname as dirname36 } from "path";
|
|
30004
|
+
import { stringify as stringify3 } from "yaml";
|
|
30005
|
+
|
|
30006
|
+
// src/commands/prs/loadCommentsCache.ts
|
|
30007
|
+
import { existsSync as existsSync64, readFileSync as readFileSync45, unlinkSync as unlinkSync13 } from "fs";
|
|
30008
|
+
import { parse as parse3 } from "yaml";
|
|
30009
|
+
function loadCommentsCache(org, repo, prNumber) {
|
|
30010
|
+
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
30011
|
+
if (!existsSync64(cachePath)) {
|
|
30012
|
+
return null;
|
|
30013
|
+
}
|
|
30014
|
+
const content = readFileSync45(cachePath, "utf8");
|
|
30015
|
+
return parse3(content);
|
|
30016
|
+
}
|
|
30017
|
+
function deleteCommentsCache(org, repo, prNumber) {
|
|
30018
|
+
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
30019
|
+
if (existsSync64(cachePath)) {
|
|
30020
|
+
unlinkSync13(cachePath);
|
|
30021
|
+
console.log("No more unresolved line comments. Cache dropped.");
|
|
30022
|
+
}
|
|
30023
|
+
}
|
|
30024
|
+
|
|
30025
|
+
// src/commands/prs/removeStaleCommentsCaches.ts
|
|
30026
|
+
import { readdirSync as readdirSync13, unlinkSync as unlinkSync14 } from "fs";
|
|
30027
|
+
import { join as join80 } from "path";
|
|
30028
|
+
var STALE_PATTERN = /^pr-\d+-comments\.yaml$/;
|
|
30029
|
+
function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
30030
|
+
const dir = join80(cwd, ".assist");
|
|
30031
|
+
let entries;
|
|
30032
|
+
try {
|
|
30033
|
+
entries = readdirSync13(dir);
|
|
30034
|
+
} catch {
|
|
30035
|
+
return;
|
|
30036
|
+
}
|
|
30037
|
+
for (const entry of entries.filter((e) => STALE_PATTERN.test(e))) {
|
|
30038
|
+
unlinkSync14(join80(dir, entry));
|
|
30039
|
+
}
|
|
30040
|
+
}
|
|
30041
|
+
|
|
30042
|
+
// src/commands/prs/listComments/updateCommentsCache.ts
|
|
30043
|
+
function writeCommentsCache(org, repo, prNumber, comments3) {
|
|
30044
|
+
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
30045
|
+
mkdirSync22(dirname36(cachePath), { recursive: true });
|
|
30046
|
+
const cacheData = {
|
|
30047
|
+
prNumber,
|
|
30048
|
+
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
30049
|
+
comments: comments3
|
|
30050
|
+
};
|
|
30051
|
+
writeFileSync36(cachePath, stringify3(cacheData));
|
|
30052
|
+
}
|
|
30053
|
+
function updateCommentsCache(org, repo, prNumber, comments3) {
|
|
30054
|
+
removeStaleCommentsCaches();
|
|
30055
|
+
if (comments3.some((c) => c.type === "line")) {
|
|
30056
|
+
writeCommentsCache(org, repo, prNumber, comments3);
|
|
30057
|
+
} else {
|
|
30058
|
+
deleteCommentsCache(org, repo, prNumber);
|
|
30059
|
+
}
|
|
30060
|
+
}
|
|
30061
|
+
|
|
30062
|
+
// src/commands/prs/azureDevops/azureDevopsCacheRepo.ts
|
|
30063
|
+
function azureDevopsCacheRepo({ org, project, repo }) {
|
|
30064
|
+
return { org, repo: `${project}/${repo}` };
|
|
30065
|
+
}
|
|
30066
|
+
|
|
30067
|
+
// src/commands/prs/azureDevops/azureDevopsRepoUrl.ts
|
|
30068
|
+
function azureDevopsRepoUrl({ org, project, repo }) {
|
|
30069
|
+
return `https://dev.azure.com/${encodeURIComponent(org)}/${encodeURIComponent(project)}/_git/${encodeURIComponent(repo)}`;
|
|
30070
|
+
}
|
|
30071
|
+
|
|
30072
|
+
// src/commands/prs/azureDevops/azureDevopsThreadRequests.ts
|
|
30073
|
+
function prRoute(pr) {
|
|
30074
|
+
return {
|
|
30075
|
+
project: pr.project,
|
|
30076
|
+
repositoryId: pr.repo,
|
|
30077
|
+
pullRequestId: pr.prId
|
|
30078
|
+
};
|
|
30079
|
+
}
|
|
30080
|
+
var azureDevopsThreadRequests = {
|
|
30081
|
+
list(pr) {
|
|
30082
|
+
return {
|
|
30083
|
+
org: pr.org,
|
|
30084
|
+
resource: "pullRequestThreads",
|
|
30085
|
+
routeParameters: prRoute(pr)
|
|
30086
|
+
};
|
|
30087
|
+
},
|
|
30088
|
+
reply(pr, threadId, content) {
|
|
30089
|
+
return {
|
|
30090
|
+
org: pr.org,
|
|
30091
|
+
resource: "pullRequestThreadComments",
|
|
30092
|
+
routeParameters: { ...prRoute(pr), threadId },
|
|
30093
|
+
method: "POST",
|
|
30094
|
+
body: { content, commentType: 1 }
|
|
30095
|
+
};
|
|
30096
|
+
},
|
|
30097
|
+
status(pr, threadId, status2) {
|
|
30098
|
+
return {
|
|
30099
|
+
org: pr.org,
|
|
30100
|
+
resource: "pullRequestThreads",
|
|
30101
|
+
routeParameters: { ...prRoute(pr), threadId },
|
|
30102
|
+
method: "PATCH",
|
|
30103
|
+
body: { status: status2 }
|
|
30104
|
+
};
|
|
30105
|
+
}
|
|
30106
|
+
};
|
|
30107
|
+
|
|
30108
|
+
// src/commands/prs/azureDevops/currentAzureDevopsPr.ts
|
|
29996
30109
|
import { execFileSync as execFileSync20 } from "child_process";
|
|
30110
|
+
function findPrForBranch(repo, branch2) {
|
|
30111
|
+
const stdout = execFileSync20(
|
|
30112
|
+
"az",
|
|
30113
|
+
[
|
|
30114
|
+
"repos",
|
|
30115
|
+
"pr",
|
|
30116
|
+
"list",
|
|
30117
|
+
"--source-branch",
|
|
30118
|
+
branch2,
|
|
30119
|
+
"--status",
|
|
30120
|
+
"active",
|
|
30121
|
+
"--org",
|
|
30122
|
+
`https://dev.azure.com/${repo.org}`,
|
|
30123
|
+
"--project",
|
|
30124
|
+
repo.project,
|
|
30125
|
+
"--repository",
|
|
30126
|
+
repo.repo,
|
|
30127
|
+
"--query",
|
|
30128
|
+
"[0].pullRequestId",
|
|
30129
|
+
"--only-show-errors",
|
|
30130
|
+
"-o",
|
|
30131
|
+
"tsv"
|
|
30132
|
+
],
|
|
30133
|
+
{ encoding: "utf8", stdio: ["ignore", "pipe", "pipe"], windowsHide: true }
|
|
30134
|
+
);
|
|
30135
|
+
return Number.parseInt(stdout.trim(), 10);
|
|
30136
|
+
}
|
|
30137
|
+
function currentAzureDevopsPr(repo) {
|
|
30138
|
+
const prId = getPinnedPr() ?? findPrForBranch(repo, getCurrentBranch2());
|
|
30139
|
+
if (Number.isNaN(prId)) {
|
|
30140
|
+
console.error("Error: No pull request found for the current branch.");
|
|
30141
|
+
process.exit(1);
|
|
30142
|
+
}
|
|
30143
|
+
return { ...repo, prId };
|
|
30144
|
+
}
|
|
30145
|
+
|
|
30146
|
+
// src/commands/prs/azureDevops/failAzureDevops.ts
|
|
30147
|
+
function errorOutput(error) {
|
|
30148
|
+
const stderr = error.stderr?.toString();
|
|
30149
|
+
if (stderr?.trim()) return stderr.trim();
|
|
30150
|
+
return error instanceof Error ? error.message : String(error);
|
|
30151
|
+
}
|
|
30152
|
+
function failAzureDevops(error) {
|
|
30153
|
+
console.error(`Error: ${azCliProblem() ?? errorOutput(error)}`);
|
|
30154
|
+
process.exit(1);
|
|
30155
|
+
}
|
|
30156
|
+
|
|
30157
|
+
// src/commands/prs/azureDevops/invokeAzDevops.ts
|
|
30158
|
+
import { execFileSync as execFileSync21 } from "child_process";
|
|
30159
|
+
import { mkdtempSync as mkdtempSync2, rmSync as rmSync6, writeFileSync as writeFileSync37 } from "fs";
|
|
30160
|
+
import { tmpdir as tmpdir6 } from "os";
|
|
30161
|
+
import { join as join81 } from "path";
|
|
30162
|
+
function azDevopsInvokeArgs(request, inFile) {
|
|
30163
|
+
return [
|
|
30164
|
+
"devops",
|
|
30165
|
+
"invoke",
|
|
30166
|
+
"--area",
|
|
30167
|
+
"git",
|
|
30168
|
+
"--resource",
|
|
30169
|
+
request.resource,
|
|
30170
|
+
"--route-parameters",
|
|
30171
|
+
...Object.entries(request.routeParameters).map(
|
|
30172
|
+
([key, value]) => `${key}=${value}`
|
|
30173
|
+
),
|
|
30174
|
+
"--org",
|
|
30175
|
+
`https://dev.azure.com/${request.org}`,
|
|
30176
|
+
"--api-version",
|
|
30177
|
+
"7.1",
|
|
30178
|
+
"--http-method",
|
|
30179
|
+
request.method ?? "GET",
|
|
30180
|
+
...inFile ? ["--in-file", inFile] : [],
|
|
30181
|
+
"--only-show-errors",
|
|
30182
|
+
"-o",
|
|
30183
|
+
"json"
|
|
30184
|
+
];
|
|
30185
|
+
}
|
|
30186
|
+
function runAz2(args) {
|
|
30187
|
+
const stdout = execFileSync21("az", args, {
|
|
30188
|
+
encoding: "utf8",
|
|
30189
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
30190
|
+
windowsHide: true
|
|
30191
|
+
});
|
|
30192
|
+
return stdout.trim() ? JSON.parse(stdout) : null;
|
|
30193
|
+
}
|
|
30194
|
+
function invokeAzDevops(request) {
|
|
30195
|
+
if (request.body === void 0) return runAz2(azDevopsInvokeArgs(request));
|
|
30196
|
+
const dir = mkdtempSync2(join81(tmpdir6(), "assist-az-"));
|
|
30197
|
+
const inFile = join81(dir, "body.json");
|
|
30198
|
+
try {
|
|
30199
|
+
writeFileSync37(inFile, JSON.stringify(request.body));
|
|
30200
|
+
return runAz2(azDevopsInvokeArgs(request, inFile));
|
|
30201
|
+
} finally {
|
|
30202
|
+
rmSync6(dir, { recursive: true, force: true });
|
|
30203
|
+
}
|
|
30204
|
+
}
|
|
30205
|
+
|
|
30206
|
+
// src/commands/prs/azureDevops/mapAzureDevopsThreads.ts
|
|
30207
|
+
var OPEN_STATUSES = /* @__PURE__ */ new Set(["active", "pending", "unknown"]);
|
|
30208
|
+
function isResolved(status2) {
|
|
30209
|
+
return status2 !== void 0 && !OPEN_STATUSES.has(status2);
|
|
30210
|
+
}
|
|
30211
|
+
function threadLine(thread) {
|
|
30212
|
+
const context = thread.threadContext;
|
|
30213
|
+
return context?.rightFileStart?.line ?? context?.leftFileStart?.line ?? null;
|
|
30214
|
+
}
|
|
30215
|
+
function threadPath(thread) {
|
|
30216
|
+
return thread.threadContext?.filePath?.replace(/^[/]/, "") ?? "";
|
|
30217
|
+
}
|
|
30218
|
+
function mapAzureDevopsThreads(threads, prUrl) {
|
|
30219
|
+
return threads.filter((thread) => !thread.isDeleted).flatMap(
|
|
30220
|
+
(thread) => (thread.comments ?? []).filter((c) => !c.isDeleted && c.commentType !== "system" && c.content).map(
|
|
30221
|
+
(c) => ({
|
|
30222
|
+
type: "line",
|
|
30223
|
+
id: thread.id,
|
|
30224
|
+
threadId: String(thread.id),
|
|
30225
|
+
user: c.author?.displayName ?? c.author?.uniqueName ?? "unknown",
|
|
30226
|
+
path: threadPath(thread),
|
|
30227
|
+
line: threadLine(thread),
|
|
30228
|
+
body: c.content ?? "",
|
|
30229
|
+
diff_hunk: "",
|
|
30230
|
+
html_url: `${prUrl}?discussionId=${thread.id}`,
|
|
30231
|
+
resolved: isResolved(thread.status)
|
|
30232
|
+
})
|
|
30233
|
+
)
|
|
30234
|
+
);
|
|
30235
|
+
}
|
|
30236
|
+
|
|
30237
|
+
// src/commands/prs/azureDevops/listAzureDevopsComments.ts
|
|
30238
|
+
function listAzureDevopsComments(repo) {
|
|
30239
|
+
try {
|
|
30240
|
+
const pr = currentAzureDevopsPr(repo);
|
|
30241
|
+
const response = invokeAzDevops(azureDevopsThreadRequests.list(pr));
|
|
30242
|
+
const comments3 = mapAzureDevopsThreads(
|
|
30243
|
+
response?.value ?? [],
|
|
30244
|
+
`${azureDevopsRepoUrl(pr)}/pullrequest/${pr.prId}`
|
|
30245
|
+
);
|
|
30246
|
+
const { org, repo: cacheRepo } = azureDevopsCacheRepo(pr);
|
|
30247
|
+
updateCommentsCache(org, cacheRepo, pr.prId, comments3);
|
|
30248
|
+
const cachePath = comments3.length > 0 ? commentsCachePath(org, cacheRepo, pr.prId) : null;
|
|
30249
|
+
return { comments: comments3, cachePath };
|
|
30250
|
+
} catch (error) {
|
|
30251
|
+
failAzureDevops(error);
|
|
30252
|
+
}
|
|
30253
|
+
}
|
|
30254
|
+
|
|
30255
|
+
// src/commands/prs/fetchThreadIds.ts
|
|
30256
|
+
import { execFileSync as execFileSync22 } from "child_process";
|
|
29997
30257
|
var THREAD_QUERY = `query($owner: String!, $repo: String!, $prNumber: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $prNumber) { reviewThreads(first: 100) { nodes { id isResolved comments(first: 100) { nodes { databaseId } } } } } } }`;
|
|
29998
30258
|
function fetchThreadIds(org, repo, prNumber) {
|
|
29999
|
-
const result =
|
|
30259
|
+
const result = execFileSync22(
|
|
30000
30260
|
"gh",
|
|
30001
30261
|
[
|
|
30002
30262
|
"api",
|
|
@@ -30070,67 +30330,6 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
30070
30330
|
);
|
|
30071
30331
|
}
|
|
30072
30332
|
|
|
30073
|
-
// src/commands/prs/listComments/updateCommentsCache.ts
|
|
30074
|
-
import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync36 } from "fs";
|
|
30075
|
-
import { dirname as dirname36 } from "path";
|
|
30076
|
-
import { stringify as stringify3 } from "yaml";
|
|
30077
|
-
|
|
30078
|
-
// src/commands/prs/loadCommentsCache.ts
|
|
30079
|
-
import { existsSync as existsSync64, readFileSync as readFileSync45, unlinkSync as unlinkSync13 } from "fs";
|
|
30080
|
-
import { parse as parse3 } from "yaml";
|
|
30081
|
-
function loadCommentsCache(org, repo, prNumber) {
|
|
30082
|
-
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
30083
|
-
if (!existsSync64(cachePath)) {
|
|
30084
|
-
return null;
|
|
30085
|
-
}
|
|
30086
|
-
const content = readFileSync45(cachePath, "utf8");
|
|
30087
|
-
return parse3(content);
|
|
30088
|
-
}
|
|
30089
|
-
function deleteCommentsCache(org, repo, prNumber) {
|
|
30090
|
-
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
30091
|
-
if (existsSync64(cachePath)) {
|
|
30092
|
-
unlinkSync13(cachePath);
|
|
30093
|
-
console.log("No more unresolved line comments. Cache dropped.");
|
|
30094
|
-
}
|
|
30095
|
-
}
|
|
30096
|
-
|
|
30097
|
-
// src/commands/prs/removeStaleCommentsCaches.ts
|
|
30098
|
-
import { readdirSync as readdirSync13, unlinkSync as unlinkSync14 } from "fs";
|
|
30099
|
-
import { join as join80 } from "path";
|
|
30100
|
-
var STALE_PATTERN = /^pr-\d+-comments\.yaml$/;
|
|
30101
|
-
function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
30102
|
-
const dir = join80(cwd, ".assist");
|
|
30103
|
-
let entries;
|
|
30104
|
-
try {
|
|
30105
|
-
entries = readdirSync13(dir);
|
|
30106
|
-
} catch {
|
|
30107
|
-
return;
|
|
30108
|
-
}
|
|
30109
|
-
for (const entry of entries.filter((e) => STALE_PATTERN.test(e))) {
|
|
30110
|
-
unlinkSync14(join80(dir, entry));
|
|
30111
|
-
}
|
|
30112
|
-
}
|
|
30113
|
-
|
|
30114
|
-
// src/commands/prs/listComments/updateCommentsCache.ts
|
|
30115
|
-
function writeCommentsCache(org, repo, prNumber, comments3) {
|
|
30116
|
-
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
30117
|
-
mkdirSync22(dirname36(cachePath), { recursive: true });
|
|
30118
|
-
const cacheData = {
|
|
30119
|
-
prNumber,
|
|
30120
|
-
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
30121
|
-
comments: comments3
|
|
30122
|
-
};
|
|
30123
|
-
writeFileSync36(cachePath, stringify3(cacheData));
|
|
30124
|
-
}
|
|
30125
|
-
function updateCommentsCache(org, repo, prNumber, comments3) {
|
|
30126
|
-
removeStaleCommentsCaches();
|
|
30127
|
-
if (comments3.some((c) => c.type === "line")) {
|
|
30128
|
-
writeCommentsCache(org, repo, prNumber, comments3);
|
|
30129
|
-
} else {
|
|
30130
|
-
deleteCommentsCache(org, repo, prNumber);
|
|
30131
|
-
}
|
|
30132
|
-
}
|
|
30133
|
-
|
|
30134
30333
|
// src/commands/prs/isNotFound.ts
|
|
30135
30334
|
function isNotFound(error) {
|
|
30136
30335
|
if (error instanceof Error) {
|
|
@@ -30153,6 +30352,8 @@ function handleKnownErrors(error) {
|
|
|
30153
30352
|
return null;
|
|
30154
30353
|
}
|
|
30155
30354
|
async function listComments() {
|
|
30355
|
+
const azure = azureDevopsRemote(process.cwd());
|
|
30356
|
+
if (azure) return listAzureDevopsComments(azure);
|
|
30156
30357
|
try {
|
|
30157
30358
|
const prNumber = getCurrentPrNumber();
|
|
30158
30359
|
const { org, repo } = getRepoInfo();
|
|
@@ -30210,6 +30411,7 @@ function commentStyle() {
|
|
|
30210
30411
|
|
|
30211
30412
|
// src/commands/prs/listComments/groupThreads.ts
|
|
30212
30413
|
function threadLocation(comment3) {
|
|
30414
|
+
if (!comment3.path) return "the PR";
|
|
30213
30415
|
return comment3.line ? `${comment3.path}:${comment3.line}` : comment3.path;
|
|
30214
30416
|
}
|
|
30215
30417
|
function groupThreads(comments3) {
|
|
@@ -30334,8 +30536,32 @@ function printComments2(result) {
|
|
|
30334
30536
|
// src/commands/prs/fixed.ts
|
|
30335
30537
|
import { execSync as execSync41 } from "child_process";
|
|
30336
30538
|
|
|
30337
|
-
// src/commands/prs/
|
|
30338
|
-
import { execFileSync as
|
|
30539
|
+
// src/commands/prs/threadTarget.ts
|
|
30540
|
+
import { execFileSync as execFileSync23 } from "child_process";
|
|
30541
|
+
|
|
30542
|
+
// src/commands/prs/azureDevops/azureDevopsThreadActions.ts
|
|
30543
|
+
function attempt(run4) {
|
|
30544
|
+
try {
|
|
30545
|
+
return run4();
|
|
30546
|
+
} catch (error) {
|
|
30547
|
+
failAzureDevops(error);
|
|
30548
|
+
}
|
|
30549
|
+
}
|
|
30550
|
+
var azureDevopsThreadActions = {
|
|
30551
|
+
currentPr(repo) {
|
|
30552
|
+
return attempt(() => currentAzureDevopsPr(repo));
|
|
30553
|
+
},
|
|
30554
|
+
reply(pr, threadId, content) {
|
|
30555
|
+
attempt(
|
|
30556
|
+
() => invokeAzDevops(azureDevopsThreadRequests.reply(pr, threadId, content))
|
|
30557
|
+
);
|
|
30558
|
+
},
|
|
30559
|
+
setStatus(pr, threadId, status2) {
|
|
30560
|
+
attempt(
|
|
30561
|
+
() => invokeAzDevops(azureDevopsThreadRequests.status(pr, threadId, status2))
|
|
30562
|
+
);
|
|
30563
|
+
}
|
|
30564
|
+
};
|
|
30339
30565
|
|
|
30340
30566
|
// src/commands/prs/replyToComment.ts
|
|
30341
30567
|
import { spawnSync as spawnSync7 } from "child_process";
|
|
@@ -30356,15 +30582,40 @@ function replyToComment(org, repo, prNumber, commentId, message3) {
|
|
|
30356
30582
|
if (result.status !== 0) throw new Error(result.stderr || result.stdout);
|
|
30357
30583
|
}
|
|
30358
30584
|
|
|
30359
|
-
// src/commands/prs/
|
|
30585
|
+
// src/commands/prs/threadTarget.ts
|
|
30360
30586
|
function resolveThread(threadId) {
|
|
30361
30587
|
const mutation = `mutation($threadId: ID!) { resolveReviewThread(input: {threadId: $threadId}) { thread { isResolved } } }`;
|
|
30362
|
-
|
|
30588
|
+
execFileSync23(
|
|
30363
30589
|
"gh",
|
|
30364
30590
|
["api", "graphql", "-f", `query=${mutation}`, "-f", `threadId=${threadId}`],
|
|
30365
30591
|
{ stdio: ["inherit", "pipe", "inherit"] }
|
|
30366
30592
|
);
|
|
30367
30593
|
}
|
|
30594
|
+
function githubTarget() {
|
|
30595
|
+
const prNumber = getCurrentPrNumber();
|
|
30596
|
+
const { org, repo } = getRepoInfo();
|
|
30597
|
+
return {
|
|
30598
|
+
org,
|
|
30599
|
+
repo,
|
|
30600
|
+
prNumber,
|
|
30601
|
+
reply: (comment3, message3) => replyToComment(org, repo, prNumber, comment3.id, message3),
|
|
30602
|
+
resolve: (comment3) => resolveThread(comment3.threadId)
|
|
30603
|
+
};
|
|
30604
|
+
}
|
|
30605
|
+
function threadTarget(status2) {
|
|
30606
|
+
const azure = azureDevopsRemote(process.cwd());
|
|
30607
|
+
if (!azure) return githubTarget();
|
|
30608
|
+
const pr = azureDevopsThreadActions.currentPr(azure);
|
|
30609
|
+
const threadId = (comment3) => Number(comment3.threadId);
|
|
30610
|
+
return {
|
|
30611
|
+
...azureDevopsCacheRepo(pr),
|
|
30612
|
+
prNumber: pr.prId,
|
|
30613
|
+
reply: (comment3, message3) => azureDevopsThreadActions.reply(pr, threadId(comment3), message3),
|
|
30614
|
+
resolve: (comment3) => azureDevopsThreadActions.setStatus(pr, threadId(comment3), status2)
|
|
30615
|
+
};
|
|
30616
|
+
}
|
|
30617
|
+
|
|
30618
|
+
// src/commands/prs/resolveCommentWithReply.ts
|
|
30368
30619
|
function requireCache(org, repo, prNumber) {
|
|
30369
30620
|
const cache7 = loadCommentsCache(org, repo, prNumber);
|
|
30370
30621
|
if (!cache7) {
|
|
@@ -30388,22 +30639,21 @@ function requireLineComment(cache7, commentId) {
|
|
|
30388
30639
|
}
|
|
30389
30640
|
return comment3;
|
|
30390
30641
|
}
|
|
30391
|
-
function cleanupCacheIfDone(cache7, org, repo, prNumber, commentId) {
|
|
30642
|
+
function cleanupCacheIfDone(cache7, { org, repo, prNumber }, commentId) {
|
|
30392
30643
|
const hasRemaining = cache7.comments.some(
|
|
30393
30644
|
(c) => c.type === "line" && c.id !== commentId
|
|
30394
30645
|
);
|
|
30395
30646
|
if (!hasRemaining) deleteCommentsCache(org, repo, prNumber);
|
|
30396
30647
|
}
|
|
30397
|
-
function resolveCommentWithReply(commentId, message3) {
|
|
30398
|
-
const
|
|
30399
|
-
const
|
|
30400
|
-
const cache7 = requireCache(org, repo, prNumber);
|
|
30648
|
+
function resolveCommentWithReply(commentId, message3, status2) {
|
|
30649
|
+
const target = threadTarget(status2);
|
|
30650
|
+
const cache7 = requireCache(target.org, target.repo, target.prNumber);
|
|
30401
30651
|
const comment3 = requireLineComment(cache7, commentId);
|
|
30402
|
-
|
|
30652
|
+
target.reply(comment3, message3);
|
|
30403
30653
|
console.log("Reply posted successfully.");
|
|
30404
|
-
|
|
30654
|
+
target.resolve(comment3);
|
|
30405
30655
|
console.log("Thread resolved successfully.");
|
|
30406
|
-
cleanupCacheIfDone(cache7,
|
|
30656
|
+
cleanupCacheIfDone(cache7, target, commentId);
|
|
30407
30657
|
}
|
|
30408
30658
|
|
|
30409
30659
|
// src/commands/prs/fixed.ts
|
|
@@ -30417,14 +30667,18 @@ function verifySha(sha) {
|
|
|
30417
30667
|
process.exit(1);
|
|
30418
30668
|
}
|
|
30419
30669
|
}
|
|
30670
|
+
function repoUrl() {
|
|
30671
|
+
const azure = azureDevopsRemote(process.cwd());
|
|
30672
|
+
if (azure) return azureDevopsRepoUrl(azure);
|
|
30673
|
+
const { org, repo } = getRepoInfo();
|
|
30674
|
+
return `https://github.com/${org}/${repo}`;
|
|
30675
|
+
}
|
|
30420
30676
|
function fixed(commentId, sha) {
|
|
30421
30677
|
try {
|
|
30422
30678
|
const fullSha = verifySha(sha);
|
|
30423
|
-
const
|
|
30424
|
-
const repoUrl = `https://github.com/${org}/${repo}`;
|
|
30425
|
-
const message3 = `Fixed in [${fullSha}](${repoUrl}/commit/${fullSha})`;
|
|
30679
|
+
const message3 = `Fixed in [${fullSha}](${repoUrl()}/commit/${fullSha})`;
|
|
30426
30680
|
pushCommit(loadConfig().worktree?.trunk === true);
|
|
30427
|
-
resolveCommentWithReply(commentId, message3);
|
|
30681
|
+
resolveCommentWithReply(commentId, message3, "fixed");
|
|
30428
30682
|
} catch (error) {
|
|
30429
30683
|
if (isGhNotInstalled(error)) {
|
|
30430
30684
|
console.error("Error: GitHub CLI (gh) is not installed.");
|
|
@@ -30446,6 +30700,13 @@ function validateBody2(body) {
|
|
|
30446
30700
|
async function reply(commentId, body) {
|
|
30447
30701
|
validateBody2(body);
|
|
30448
30702
|
await reviewProposedPrComment(`Reply to comment #${commentId}`, body, null);
|
|
30703
|
+
const azure = azureDevopsRemote(process.cwd());
|
|
30704
|
+
if (azure) {
|
|
30705
|
+
const pr = azureDevopsThreadActions.currentPr(azure);
|
|
30706
|
+
azureDevopsThreadActions.reply(pr, commentId, body);
|
|
30707
|
+
console.log("Reply posted successfully.");
|
|
30708
|
+
return;
|
|
30709
|
+
}
|
|
30449
30710
|
try {
|
|
30450
30711
|
const prNumber = getCurrentPrNumber();
|
|
30451
30712
|
const { org, repo } = getRepoInfo();
|
|
@@ -30471,7 +30732,7 @@ function validateReason(reason4) {
|
|
|
30471
30732
|
}
|
|
30472
30733
|
}
|
|
30473
30734
|
function validateShaReferences(reason4) {
|
|
30474
|
-
const commitLinkPattern = /\[[0-9a-f]{7}\]\(https:\/\/github\.com\/[^/]+\/[^/]+\/commit\/([0-9a-f]{40})\)/gi;
|
|
30735
|
+
const commitLinkPattern = /\[[0-9a-f]{7}\]\(https:\/\/(?:github\.com\/[^/]+\/[^/]+|dev\.azure\.com\/[^/]+\/[^/]+\/_git\/[^/]+)\/commit\/([0-9a-f]{40})\)/gi;
|
|
30475
30736
|
const shas = Array.from(reason4.matchAll(commitLinkPattern), (m) => m[1]);
|
|
30476
30737
|
if (shas.length === 0) {
|
|
30477
30738
|
return;
|
|
@@ -30500,7 +30761,7 @@ async function wontfix(commentId, reason4) {
|
|
|
30500
30761
|
null
|
|
30501
30762
|
);
|
|
30502
30763
|
try {
|
|
30503
|
-
resolveCommentWithReply(commentId, reason4);
|
|
30764
|
+
resolveCommentWithReply(commentId, reason4, "wontFix");
|
|
30504
30765
|
} catch (error) {
|
|
30505
30766
|
if (isGhNotInstalled(error)) {
|
|
30506
30767
|
console.error("Error: GitHub CLI (gh) is not installed.");
|
|
@@ -30964,7 +31225,7 @@ function buildValidatedBody(options2, usage) {
|
|
|
30964
31225
|
}
|
|
30965
31226
|
|
|
30966
31227
|
// src/commands/prs/placePr.ts
|
|
30967
|
-
import { execFileSync as
|
|
31228
|
+
import { execFileSync as execFileSync24 } from "child_process";
|
|
30968
31229
|
|
|
30969
31230
|
// src/commands/prs/buildCreateArgs.ts
|
|
30970
31231
|
function buildCreateArgs(title, body, options2, attachments = []) {
|
|
@@ -31050,7 +31311,7 @@ function buildEditArgs(number, title, body, attachments = []) {
|
|
|
31050
31311
|
// src/commands/prs/placePr.ts
|
|
31051
31312
|
function hasUpstream2() {
|
|
31052
31313
|
try {
|
|
31053
|
-
|
|
31314
|
+
execFileSync24(
|
|
31054
31315
|
"git",
|
|
31055
31316
|
["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"],
|
|
31056
31317
|
{ stdio: "pipe" }
|
|
@@ -31062,7 +31323,7 @@ function hasUpstream2() {
|
|
|
31062
31323
|
}
|
|
31063
31324
|
function ensureBranchPushed() {
|
|
31064
31325
|
const args = hasUpstream2() ? ["push"] : ["push", "--set-upstream", "origin", "HEAD"];
|
|
31065
|
-
|
|
31326
|
+
execFileSync24("git", args, { stdio: "inherit" });
|
|
31066
31327
|
}
|
|
31067
31328
|
async function placePr(prNumber, title, body, options2, attachments = []) {
|
|
31068
31329
|
const args = prNumber !== null ? buildEditArgs(prNumber, title, body, attachments) : buildCreateArgs(title, body, options2, attachments);
|
|
@@ -31133,10 +31394,10 @@ function warn(reason4) {
|
|
|
31133
31394
|
}
|
|
31134
31395
|
|
|
31135
31396
|
// src/commands/prs/enableAutoMerge.ts
|
|
31136
|
-
import { execFileSync as
|
|
31397
|
+
import { execFileSync as execFileSync25 } from "child_process";
|
|
31137
31398
|
function enableAutoMerge() {
|
|
31138
31399
|
try {
|
|
31139
|
-
|
|
31400
|
+
execFileSync25(
|
|
31140
31401
|
"gh",
|
|
31141
31402
|
["pr", "merge", getCurrentBranch2(), "--auto", "--squash"],
|
|
31142
31403
|
{ stdio: "inherit" }
|
|
@@ -31394,10 +31655,10 @@ function prsSlackChannel() {
|
|
|
31394
31655
|
}
|
|
31395
31656
|
|
|
31396
31657
|
// src/commands/prs/status/fetchReviewThreads.ts
|
|
31397
|
-
import { execFileSync as
|
|
31658
|
+
import { execFileSync as execFileSync26 } from "child_process";
|
|
31398
31659
|
var THREAD_QUERY2 = `query($owner: String!, $repo: String!, $prNumber: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $prNumber) { reviewThreads(first: 100) { nodes { isResolved } } } } }`;
|
|
31399
31660
|
function fetchReviewThreads(org, repo, prNumber) {
|
|
31400
|
-
const output =
|
|
31661
|
+
const output = execFileSync26(
|
|
31401
31662
|
"gh",
|
|
31402
31663
|
[
|
|
31403
31664
|
"api",
|
|
@@ -32954,9 +33215,9 @@ async function notify() {
|
|
|
32954
33215
|
|
|
32955
33216
|
// src/commands/screenshot.ts
|
|
32956
33217
|
import { execSync as execSync49 } from "child_process";
|
|
32957
|
-
import { existsSync as existsSync65, mkdirSync as mkdirSync23, unlinkSync as unlinkSync15, writeFileSync as
|
|
32958
|
-
import { tmpdir as
|
|
32959
|
-
import { join as
|
|
33218
|
+
import { existsSync as existsSync65, mkdirSync as mkdirSync23, unlinkSync as unlinkSync15, writeFileSync as writeFileSync38 } from "fs";
|
|
33219
|
+
import { tmpdir as tmpdir7 } from "os";
|
|
33220
|
+
import { join as join82, resolve as resolve24 } from "path";
|
|
32960
33221
|
import chalk208 from "chalk";
|
|
32961
33222
|
|
|
32962
33223
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -33093,8 +33354,8 @@ function buildOutputPath(outputDir, processName) {
|
|
|
33093
33354
|
return resolve24(outputDir, `${processName}-${timestamp6}.png`);
|
|
33094
33355
|
}
|
|
33095
33356
|
function runPowerShellScript(processName, outputPath) {
|
|
33096
|
-
const scriptPath =
|
|
33097
|
-
|
|
33357
|
+
const scriptPath = join82(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
|
|
33358
|
+
writeFileSync38(scriptPath, captureWindowPs1, "utf8");
|
|
33098
33359
|
try {
|
|
33099
33360
|
execSync49(
|
|
33100
33361
|
`powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
|
|
@@ -33208,9 +33469,9 @@ function buildLimitsSegment(rateLimits) {
|
|
|
33208
33469
|
|
|
33209
33470
|
// src/commands/readGitBranch.ts
|
|
33210
33471
|
import { readFileSync as readFileSync48, statSync as statSync10 } from "fs";
|
|
33211
|
-
import { isAbsolute as isAbsolute6, join as
|
|
33472
|
+
import { isAbsolute as isAbsolute6, join as join83, resolve as resolve25 } from "path";
|
|
33212
33473
|
function resolveGitDir(cwd) {
|
|
33213
|
-
const dotGit =
|
|
33474
|
+
const dotGit = join83(cwd, ".git");
|
|
33214
33475
|
let stat5;
|
|
33215
33476
|
try {
|
|
33216
33477
|
stat5 = statSync10(dotGit);
|
|
@@ -33240,7 +33501,7 @@ function readGitBranch(cwd) {
|
|
|
33240
33501
|
}
|
|
33241
33502
|
let head;
|
|
33242
33503
|
try {
|
|
33243
|
-
head = readFileSync48(
|
|
33504
|
+
head = readFileSync48(join83(gitDir, "HEAD"), "utf8");
|
|
33244
33505
|
} catch {
|
|
33245
33506
|
return null;
|
|
33246
33507
|
}
|
|
@@ -35716,7 +35977,7 @@ function exitWith(message3) {
|
|
|
35716
35977
|
}
|
|
35717
35978
|
|
|
35718
35979
|
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
35719
|
-
import { execFileSync as
|
|
35980
|
+
import { execFileSync as execFileSync28 } from "child_process";
|
|
35720
35981
|
import chalk232 from "chalk";
|
|
35721
35982
|
|
|
35722
35983
|
// src/commands/review/highLevel/buildGlobProposalPrompt.ts
|
|
@@ -35765,7 +36026,7 @@ function readGlobs(value) {
|
|
|
35765
36026
|
}
|
|
35766
36027
|
|
|
35767
36028
|
// src/commands/review/highLevel/summariseRepoTree.ts
|
|
35768
|
-
import { execFileSync as
|
|
36029
|
+
import { execFileSync as execFileSync27 } from "child_process";
|
|
35769
36030
|
import { dirname as dirname38, extname as extname6 } from "path";
|
|
35770
36031
|
var MAX_DIRECTORIES = 200;
|
|
35771
36032
|
var MAX_EXTENSIONS_PER_DIRECTORY = 6;
|
|
@@ -35781,7 +36042,7 @@ function summariseRepoTree(cwd = process.cwd()) {
|
|
|
35781
36042
|
}
|
|
35782
36043
|
function listTrackedFiles(cwd) {
|
|
35783
36044
|
try {
|
|
35784
|
-
return
|
|
36045
|
+
return execFileSync27("git", ["ls-files"], {
|
|
35785
36046
|
cwd,
|
|
35786
36047
|
encoding: "utf8",
|
|
35787
36048
|
maxBuffer: 64 * 1024 * 1024
|
|
@@ -35826,7 +36087,7 @@ function proposeHighLevelGlobs(cwd = process.cwd()) {
|
|
|
35826
36087
|
}
|
|
35827
36088
|
function askClaude(prompt, cwd) {
|
|
35828
36089
|
try {
|
|
35829
|
-
return
|
|
36090
|
+
return execFileSync28("claude", ["-p", "--model", "sonnet", prompt], {
|
|
35830
36091
|
cwd,
|
|
35831
36092
|
encoding: "utf8",
|
|
35832
36093
|
timeout: 12e4,
|
|
@@ -36420,11 +36681,11 @@ function evaluateHighLevelChecks(subject) {
|
|
|
36420
36681
|
}
|
|
36421
36682
|
|
|
36422
36683
|
// src/commands/review/highLevel/fetchFileAtSha.ts
|
|
36423
|
-
import { execFileSync as
|
|
36684
|
+
import { execFileSync as execFileSync29 } from "child_process";
|
|
36424
36685
|
function fetchFileAtSha(repo, sha, path108) {
|
|
36425
36686
|
const encodedPath = path108.split("/").map(encodeURIComponent).join("/");
|
|
36426
36687
|
try {
|
|
36427
|
-
return
|
|
36688
|
+
return execFileSync29(
|
|
36428
36689
|
"gh",
|
|
36429
36690
|
[
|
|
36430
36691
|
"api",
|
|
@@ -36446,7 +36707,7 @@ function fetchFileAtSha(repo, sha, path108) {
|
|
|
36446
36707
|
}
|
|
36447
36708
|
|
|
36448
36709
|
// src/commands/review/highLevel/fetchHighLevelFiles.ts
|
|
36449
|
-
import { execFileSync as
|
|
36710
|
+
import { execFileSync as execFileSync30 } from "child_process";
|
|
36450
36711
|
import { createHash as createHash4 } from "crypto";
|
|
36451
36712
|
var JQ = ".[] | {filename,status,additions,deletions,patch} | @json";
|
|
36452
36713
|
function toStatus(status2) {
|
|
@@ -36459,7 +36720,7 @@ function diffUrl(repo, prNumber, path108) {
|
|
|
36459
36720
|
return `https://github.com/${repo}/pull/${prNumber}/files#diff-${anchor}`;
|
|
36460
36721
|
}
|
|
36461
36722
|
function fetchHighLevelFiles(prNumber, repo) {
|
|
36462
|
-
const out =
|
|
36723
|
+
const out = execFileSync30(
|
|
36463
36724
|
"gh",
|
|
36464
36725
|
["api", `repos/${repo}/pulls/${prNumber}/files`, "--paginate", "--jq", JQ],
|
|
36465
36726
|
{ encoding: "utf8", maxBuffer: 64 * 1024 * 1024 }
|
|
@@ -36488,7 +36749,7 @@ function sleepSync(ms) {
|
|
|
36488
36749
|
}
|
|
36489
36750
|
function waitForMergeable(initial, refetch, delayMs = DELAY_MS) {
|
|
36490
36751
|
let mergeable = initial;
|
|
36491
|
-
for (let
|
|
36752
|
+
for (let attempt2 = 1; mergeable === "UNKNOWN" && attempt2 < MAX_ATTEMPTS; attempt2++) {
|
|
36492
36753
|
sleepSync(delayMs);
|
|
36493
36754
|
mergeable = refetch();
|
|
36494
36755
|
}
|
|
@@ -36526,12 +36787,12 @@ function fetchHighLevelPr(prNumber, repo) {
|
|
|
36526
36787
|
}
|
|
36527
36788
|
|
|
36528
36789
|
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
36529
|
-
import { join as
|
|
36790
|
+
import { join as join84 } from "path";
|
|
36530
36791
|
function slug(value) {
|
|
36531
36792
|
return value.replace(/[^\w.-]+/g, "-");
|
|
36532
36793
|
}
|
|
36533
36794
|
function highLevelReviewPath(repo, headRef, headSha) {
|
|
36534
|
-
return
|
|
36795
|
+
return join84(
|
|
36535
36796
|
getStoreDir(),
|
|
36536
36797
|
"high-level-reviews",
|
|
36537
36798
|
slug(repo),
|
|
@@ -36697,17 +36958,17 @@ function buildHighLevelRecord(subject, decision) {
|
|
|
36697
36958
|
}
|
|
36698
36959
|
|
|
36699
36960
|
// src/commands/review/highLevel/clearHighLevelDraft.ts
|
|
36700
|
-
import { rmSync as
|
|
36961
|
+
import { rmSync as rmSync7 } from "fs";
|
|
36701
36962
|
function clearHighLevelDraft(repo, headRef, headSha) {
|
|
36702
|
-
|
|
36963
|
+
rmSync7(highLevelDraftPath(repo, headRef, headSha), { force: true });
|
|
36703
36964
|
}
|
|
36704
36965
|
|
|
36705
36966
|
// src/commands/review/highLevel/writeJsonFile.ts
|
|
36706
|
-
import { mkdirSync as mkdirSync24, writeFileSync as
|
|
36967
|
+
import { mkdirSync as mkdirSync24, writeFileSync as writeFileSync39 } from "fs";
|
|
36707
36968
|
import { dirname as dirname39 } from "path";
|
|
36708
36969
|
function writeJsonFile(path108, data) {
|
|
36709
36970
|
mkdirSync24(dirname39(path108), { recursive: true });
|
|
36710
|
-
|
|
36971
|
+
writeFileSync39(path108, `${JSON.stringify(data, null, 2)}
|
|
36711
36972
|
`);
|
|
36712
36973
|
return path108;
|
|
36713
36974
|
}
|
|
@@ -37690,7 +37951,7 @@ import { format as format2 } from "util";
|
|
|
37690
37951
|
|
|
37691
37952
|
// src/commands/review/createReviewLogSink.ts
|
|
37692
37953
|
import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync25 } from "fs";
|
|
37693
|
-
import { join as
|
|
37954
|
+
import { join as join85 } from "path";
|
|
37694
37955
|
var LOG_FILE = "review.log";
|
|
37695
37956
|
function createReviewLogSink() {
|
|
37696
37957
|
let logPath2;
|
|
@@ -37707,7 +37968,7 @@ function createReviewLogSink() {
|
|
|
37707
37968
|
},
|
|
37708
37969
|
attach(reviewDir) {
|
|
37709
37970
|
mkdirSync25(reviewDir, { recursive: true });
|
|
37710
|
-
logPath2 =
|
|
37971
|
+
logPath2 = join85(reviewDir, LOG_FILE);
|
|
37711
37972
|
const lines2 = [
|
|
37712
37973
|
"",
|
|
37713
37974
|
`=== ${(/* @__PURE__ */ new Date()).toISOString()} ===`,
|
|
@@ -37957,7 +38218,7 @@ function buildCodexModelArgs() {
|
|
|
37957
38218
|
}
|
|
37958
38219
|
|
|
37959
38220
|
// src/commands/review/runClaudeReviewer.ts
|
|
37960
|
-
import { writeFileSync as
|
|
38221
|
+
import { writeFileSync as writeFileSync40 } from "fs";
|
|
37961
38222
|
|
|
37962
38223
|
// src/commands/review/formatToolSummary.ts
|
|
37963
38224
|
function truncate2(value, max = 80) {
|
|
@@ -38396,7 +38657,7 @@ async function runClaudeReviewer(spec) {
|
|
|
38396
38657
|
onLine
|
|
38397
38658
|
});
|
|
38398
38659
|
if (result.exitCode === 0 && state.finalText)
|
|
38399
|
-
|
|
38660
|
+
writeFileSync40(spec.outputPath, state.finalText);
|
|
38400
38661
|
const finalised = finaliseReviewerRun(
|
|
38401
38662
|
{ ...spec, command, model: override?.model },
|
|
38402
38663
|
spinner,
|
|
@@ -38922,9 +39183,9 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
38922
39183
|
|
|
38923
39184
|
// src/commands/review/buildReviewPaths.ts
|
|
38924
39185
|
import { homedir as homedir25 } from "os";
|
|
38925
|
-
import { basename as basename24, join as
|
|
39186
|
+
import { basename as basename24, join as join86 } from "path";
|
|
38926
39187
|
function buildReviewPaths(repoRoot2, key) {
|
|
38927
|
-
const reviewDir =
|
|
39188
|
+
const reviewDir = join86(
|
|
38928
39189
|
homedir25(),
|
|
38929
39190
|
".assist",
|
|
38930
39191
|
"reviews",
|
|
@@ -38933,10 +39194,10 @@ function buildReviewPaths(repoRoot2, key) {
|
|
|
38933
39194
|
);
|
|
38934
39195
|
return {
|
|
38935
39196
|
reviewDir,
|
|
38936
|
-
requestPath:
|
|
38937
|
-
claudePath:
|
|
38938
|
-
codexPath:
|
|
38939
|
-
synthesisPath:
|
|
39197
|
+
requestPath: join86(reviewDir, "request.md"),
|
|
39198
|
+
claudePath: join86(reviewDir, "claude.md"),
|
|
39199
|
+
codexPath: join86(reviewDir, "codex.md"),
|
|
39200
|
+
synthesisPath: join86(reviewDir, "synthesis.md")
|
|
38940
39201
|
};
|
|
38941
39202
|
}
|
|
38942
39203
|
|
|
@@ -38974,7 +39235,7 @@ function fetchExistingComments() {
|
|
|
38974
39235
|
}
|
|
38975
39236
|
|
|
38976
39237
|
// src/commands/review/prepareReviewDir.ts
|
|
38977
|
-
import { existsSync as existsSync69, mkdirSync as mkdirSync26, unlinkSync as unlinkSync18, writeFileSync as
|
|
39238
|
+
import { existsSync as existsSync69, mkdirSync as mkdirSync26, unlinkSync as unlinkSync18, writeFileSync as writeFileSync41 } from "fs";
|
|
38978
39239
|
function clearReviewFiles(paths) {
|
|
38979
39240
|
for (const path108 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
38980
39241
|
if (existsSync69(path108)) unlinkSync18(path108);
|
|
@@ -38983,7 +39244,7 @@ function clearReviewFiles(paths) {
|
|
|
38983
39244
|
function prepareReviewDir(paths, requestBody, force) {
|
|
38984
39245
|
mkdirSync26(paths.reviewDir, { recursive: true });
|
|
38985
39246
|
if (force) clearReviewFiles(paths);
|
|
38986
|
-
|
|
39247
|
+
writeFileSync41(paths.requestPath, requestBody);
|
|
38987
39248
|
}
|
|
38988
39249
|
|
|
38989
39250
|
// src/commands/review/setupReviewDir.ts
|
|
@@ -39631,7 +39892,7 @@ function registerReview(program) {
|
|
|
39631
39892
|
}
|
|
39632
39893
|
|
|
39633
39894
|
// src/commands/rules/addRule.ts
|
|
39634
|
-
import { existsSync as existsSync72, readFileSync as readFileSync56, writeFileSync as
|
|
39895
|
+
import { existsSync as existsSync72, readFileSync as readFileSync56, writeFileSync as writeFileSync43 } from "fs";
|
|
39635
39896
|
import path87 from "path";
|
|
39636
39897
|
import chalk242 from "chalk";
|
|
39637
39898
|
|
|
@@ -39706,7 +39967,7 @@ function resolveRuleScope(target) {
|
|
|
39706
39967
|
}
|
|
39707
39968
|
|
|
39708
39969
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
39709
|
-
import { existsSync as existsSync71, readFileSync as readFileSync55, writeFileSync as
|
|
39970
|
+
import { existsSync as existsSync71, readFileSync as readFileSync55, writeFileSync as writeFileSync42 } from "fs";
|
|
39710
39971
|
import path86 from "path";
|
|
39711
39972
|
|
|
39712
39973
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
@@ -39758,7 +40019,7 @@ function updateScopedRulesIndex(root2) {
|
|
|
39758
40019
|
const rootFile = path86.join(root2, "CLAUDE.md");
|
|
39759
40020
|
const before = existsSync71(rootFile) ? readFileSync55(rootFile, "utf8") : "";
|
|
39760
40021
|
const after = upsertScopedRulesPointer(before, directories);
|
|
39761
|
-
if (after !== before)
|
|
40022
|
+
if (after !== before) writeFileSync42(rootFile, after);
|
|
39762
40023
|
return directories;
|
|
39763
40024
|
}
|
|
39764
40025
|
|
|
@@ -39777,7 +40038,7 @@ function addRule(text17, options2) {
|
|
|
39777
40038
|
const targetDir = path87.dirname(target);
|
|
39778
40039
|
const root2 = findRepoRoot(targetDir) ?? targetDir;
|
|
39779
40040
|
const code = nextRuleCode(root2);
|
|
39780
|
-
|
|
40041
|
+
writeFileSync43(
|
|
39781
40042
|
target,
|
|
39782
40043
|
insertRuleBullet(read2(target), {
|
|
39783
40044
|
code,
|
|
@@ -40308,10 +40569,10 @@ function parseSlackThreadRef(value) {
|
|
|
40308
40569
|
}
|
|
40309
40570
|
|
|
40310
40571
|
// src/commands/slack/postSlackMessage.ts
|
|
40311
|
-
import { mkdirSync as mkdirSync28, writeFileSync as
|
|
40572
|
+
import { mkdirSync as mkdirSync28, writeFileSync as writeFileSync45 } from "fs";
|
|
40312
40573
|
|
|
40313
40574
|
// src/commands/slack/previewSlackThreadParts.ts
|
|
40314
|
-
import { mkdirSync as mkdirSync27, writeFileSync as
|
|
40575
|
+
import { mkdirSync as mkdirSync27, writeFileSync as writeFileSync44 } from "fs";
|
|
40315
40576
|
|
|
40316
40577
|
// src/commands/slack/readSlackParts.ts
|
|
40317
40578
|
import { readFileSync as readFileSync57 } from "fs";
|
|
@@ -40357,12 +40618,12 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
40357
40618
|
}
|
|
40358
40619
|
|
|
40359
40620
|
// src/commands/slack/slackWorkingFile.ts
|
|
40360
|
-
import { join as
|
|
40621
|
+
import { join as join87 } from "path";
|
|
40361
40622
|
function slackWorkingFile(channel, partIndex) {
|
|
40362
40623
|
const slug2 = channel.replace(/^[#@]/, "").toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "channel";
|
|
40363
|
-
const dir =
|
|
40624
|
+
const dir = join87(getStoreDir(), "slack");
|
|
40364
40625
|
const name = partIndex === void 0 ? slug2 : `${slug2}-${partIndex}`;
|
|
40365
|
-
return { dir, bodyPath:
|
|
40626
|
+
return { dir, bodyPath: join87(dir, `${name}.md`) };
|
|
40366
40627
|
}
|
|
40367
40628
|
|
|
40368
40629
|
// src/commands/slack/previewSlackThreadParts.ts
|
|
@@ -40377,7 +40638,7 @@ async function previewSlackThreadParts({
|
|
|
40377
40638
|
mkdirSync27(dir, { recursive: true });
|
|
40378
40639
|
const paths = bodies.map((body, index2) => {
|
|
40379
40640
|
const { bodyPath } = slackWorkingFile(channel, index2 + 1);
|
|
40380
|
-
|
|
40641
|
+
writeFileSync44(bodyPath, `${body}
|
|
40381
40642
|
`);
|
|
40382
40643
|
return bodyPath;
|
|
40383
40644
|
});
|
|
@@ -40429,7 +40690,7 @@ async function postSlackMessage(channelArg, options2) {
|
|
|
40429
40690
|
}
|
|
40430
40691
|
const { dir, bodyPath } = slackWorkingFile(channel);
|
|
40431
40692
|
mkdirSync28(dir, { recursive: true });
|
|
40432
|
-
|
|
40693
|
+
writeFileSync45(bodyPath, `${body}
|
|
40433
40694
|
`);
|
|
40434
40695
|
await reviewProposedSlackMessage({ channel, threadTs }, body, bodyPath);
|
|
40435
40696
|
console.log(`Approved for ${target}. The body to post is at:`);
|
|
@@ -41545,20 +41806,20 @@ async function configure() {
|
|
|
41545
41806
|
|
|
41546
41807
|
// src/commands/transcript/list.ts
|
|
41547
41808
|
import { existsSync as existsSync78, readdirSync as readdirSync21, statSync as statSync12 } from "fs";
|
|
41548
|
-
import { join as
|
|
41809
|
+
import { join as join99 } from "path";
|
|
41549
41810
|
function list4() {
|
|
41550
41811
|
const { vttDir } = getTranscriptConfig();
|
|
41551
41812
|
if (!existsSync78(vttDir)) return;
|
|
41552
41813
|
for (const entry of readdirSync21(vttDir)) {
|
|
41553
41814
|
if (!entry.endsWith(".vtt")) continue;
|
|
41554
|
-
if (statSync12(
|
|
41815
|
+
if (statSync12(join99(vttDir, entry)).isDirectory()) continue;
|
|
41555
41816
|
console.log(entry);
|
|
41556
41817
|
}
|
|
41557
41818
|
}
|
|
41558
41819
|
|
|
41559
41820
|
// src/commands/transcript/move.ts
|
|
41560
|
-
import { existsSync as existsSync79, mkdirSync as mkdirSync34, renameSync as renameSync4, writeFileSync as
|
|
41561
|
-
import { basename as basename27, join as
|
|
41821
|
+
import { existsSync as existsSync79, mkdirSync as mkdirSync34, renameSync as renameSync4, writeFileSync as writeFileSync50 } from "fs";
|
|
41822
|
+
import { basename as basename27, join as join100 } from "path";
|
|
41562
41823
|
|
|
41563
41824
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
41564
41825
|
function convertVttToMarkdown(inputPath) {
|
|
@@ -41568,9 +41829,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
41568
41829
|
// src/commands/transcript/move.ts
|
|
41569
41830
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
41570
41831
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
41571
|
-
const processedDir =
|
|
41832
|
+
const processedDir = join100(vttDir, "processed");
|
|
41572
41833
|
mkdirSync34(processedDir, { recursive: true });
|
|
41573
|
-
renameSync4(sourcePath,
|
|
41834
|
+
renameSync4(sourcePath, join100(processedDir, filename));
|
|
41574
41835
|
}
|
|
41575
41836
|
function move(file, options2) {
|
|
41576
41837
|
const { date, client } = options2;
|
|
@@ -41580,25 +41841,25 @@ function move(file, options2) {
|
|
|
41580
41841
|
}
|
|
41581
41842
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
41582
41843
|
const filename = basename27(file);
|
|
41583
|
-
const sourcePath =
|
|
41844
|
+
const sourcePath = join100(vttDir, filename);
|
|
41584
41845
|
if (!existsSync79(sourcePath)) {
|
|
41585
41846
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
41586
41847
|
process.exit(1);
|
|
41587
41848
|
}
|
|
41588
41849
|
const base = basename27(filename, ".vtt").replace(/ Transcription$/, "");
|
|
41589
41850
|
const outputName = `${date} ${base}.md`;
|
|
41590
|
-
const formattedDir =
|
|
41851
|
+
const formattedDir = join100(transcriptsDir, client);
|
|
41591
41852
|
mkdirSync34(formattedDir, { recursive: true });
|
|
41592
|
-
const formattedPath =
|
|
41593
|
-
|
|
41853
|
+
const formattedPath = join100(formattedDir, outputName);
|
|
41854
|
+
writeFileSync50(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
41594
41855
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
41595
|
-
const summaryPath =
|
|
41856
|
+
const summaryPath = join100(summaryDir, client, outputName);
|
|
41596
41857
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
41597
41858
|
console.log(`Summary target: ${summaryPath}`);
|
|
41598
41859
|
}
|
|
41599
41860
|
|
|
41600
41861
|
// src/commands/transcript/merge.ts
|
|
41601
|
-
import { existsSync as existsSync80, writeFileSync as
|
|
41862
|
+
import { existsSync as existsSync80, writeFileSync as writeFileSync51 } from "fs";
|
|
41602
41863
|
import { basename as basename28 } from "path";
|
|
41603
41864
|
|
|
41604
41865
|
// src/commands/transcript/failTranscript.ts
|
|
@@ -41775,7 +42036,7 @@ async function merge(files, options2 = {}) {
|
|
|
41775
42036
|
console.log(document);
|
|
41776
42037
|
return;
|
|
41777
42038
|
}
|
|
41778
|
-
|
|
42039
|
+
writeFileSync51(options2.out, `${document}
|
|
41779
42040
|
`, "utf8");
|
|
41780
42041
|
console.log(`Merged transcript: ${options2.out}`);
|
|
41781
42042
|
}
|
|
@@ -42288,13 +42549,13 @@ Total: ${violations.length} forbidden string(s).`);
|
|
|
42288
42549
|
}
|
|
42289
42550
|
|
|
42290
42551
|
// src/commands/verify/hardcodedColors.ts
|
|
42291
|
-
import { execFileSync as
|
|
42552
|
+
import { execFileSync as execFileSync31 } from "child_process";
|
|
42292
42553
|
import { minimatch as minimatch11 } from "minimatch";
|
|
42293
42554
|
var pattern = "0x[0-9a-fA-F]{6}|#[0-9a-fA-F]{3,6}";
|
|
42294
42555
|
function hardcodedColors() {
|
|
42295
42556
|
const ignoreGlobs = loadConfig().hardcodedColors?.ignore ?? [];
|
|
42296
42557
|
try {
|
|
42297
|
-
const output =
|
|
42558
|
+
const output = execFileSync31("grep", ["-rEnH", "-f", "-", "src/"], {
|
|
42298
42559
|
encoding: "utf8",
|
|
42299
42560
|
input: `${pattern}
|
|
42300
42561
|
`
|
|
@@ -43077,11 +43338,11 @@ ${buildWatchReport(from)}`);
|
|
|
43077
43338
|
}
|
|
43078
43339
|
|
|
43079
43340
|
// src/commands/watch/consumeMarker.ts
|
|
43080
|
-
import { existsSync as existsSync83, rmSync as
|
|
43341
|
+
import { existsSync as existsSync83, rmSync as rmSync11 } from "fs";
|
|
43081
43342
|
function consumeMarker(path108) {
|
|
43082
43343
|
try {
|
|
43083
43344
|
if (!existsSync83(path108)) return false;
|
|
43084
|
-
|
|
43345
|
+
rmSync11(path108);
|
|
43085
43346
|
return true;
|
|
43086
43347
|
} catch {
|
|
43087
43348
|
return false;
|
|
@@ -43258,10 +43519,10 @@ function registerWatchWait(watchCommand) {
|
|
|
43258
43519
|
}
|
|
43259
43520
|
|
|
43260
43521
|
// src/commands/watch/simulateDivergence.ts
|
|
43261
|
-
import { writeFileSync as
|
|
43522
|
+
import { writeFileSync as writeFileSync52 } from "fs";
|
|
43262
43523
|
function simulateDivergence() {
|
|
43263
43524
|
try {
|
|
43264
|
-
|
|
43525
|
+
writeFileSync52(simulatedDivergencePath(), "");
|
|
43265
43526
|
console.log(
|
|
43266
43527
|
`the next assist watch wait poll in ${runGit3(["rev-parse", "--show-toplevel"])} will exit 3 as a simulated divergence`
|
|
43267
43528
|
);
|
|
@@ -43513,9 +43774,9 @@ async function auth() {
|
|
|
43513
43774
|
}
|
|
43514
43775
|
|
|
43515
43776
|
// src/commands/roam/postRoamActivity.ts
|
|
43516
|
-
import { execFileSync as
|
|
43777
|
+
import { execFileSync as execFileSync32 } from "child_process";
|
|
43517
43778
|
import { readdirSync as readdirSync23, readFileSync as readFileSync65, statSync as statSync13 } from "fs";
|
|
43518
|
-
import { join as
|
|
43779
|
+
import { join as join101 } from "path";
|
|
43519
43780
|
function findPortFile(roamDir) {
|
|
43520
43781
|
let entries;
|
|
43521
43782
|
try {
|
|
@@ -43524,7 +43785,7 @@ function findPortFile(roamDir) {
|
|
|
43524
43785
|
return void 0;
|
|
43525
43786
|
}
|
|
43526
43787
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
43527
|
-
const path108 =
|
|
43788
|
+
const path108 = join101(roamDir, name);
|
|
43528
43789
|
try {
|
|
43529
43790
|
return { path: path108, mtimeMs: statSync13(path108).mtimeMs };
|
|
43530
43791
|
} catch {
|
|
@@ -43541,7 +43802,7 @@ var PID_BY_APP = {
|
|
|
43541
43802
|
function postRoamActivity(app, event) {
|
|
43542
43803
|
const appData = process.env.APPDATA;
|
|
43543
43804
|
if (!appData) return;
|
|
43544
|
-
const portFile = findPortFile(
|
|
43805
|
+
const portFile = findPortFile(join101(appData, "Roam"));
|
|
43545
43806
|
if (!portFile) return;
|
|
43546
43807
|
let port;
|
|
43547
43808
|
try {
|
|
@@ -43552,7 +43813,7 @@ function postRoamActivity(app, event) {
|
|
|
43552
43813
|
const pid = PID_BY_APP[app] ?? 99999;
|
|
43553
43814
|
const url = `http://127.0.0.1:${port}/api/v1/activity/${app}/${event}?pid=${pid}`;
|
|
43554
43815
|
try {
|
|
43555
|
-
|
|
43816
|
+
execFileSync32("curl", ["-sf", "--max-time", "0.2", "-X", "POST", url], {
|
|
43556
43817
|
stdio: "ignore"
|
|
43557
43818
|
});
|
|
43558
43819
|
} catch {
|
|
@@ -43726,8 +43987,8 @@ function link2() {
|
|
|
43726
43987
|
}
|
|
43727
43988
|
|
|
43728
43989
|
// src/commands/run/add.ts
|
|
43729
|
-
import { mkdirSync as mkdirSync35, writeFileSync as
|
|
43730
|
-
import { join as
|
|
43990
|
+
import { mkdirSync as mkdirSync35, writeFileSync as writeFileSync53 } from "fs";
|
|
43991
|
+
import { join as join102 } from "path";
|
|
43731
43992
|
|
|
43732
43993
|
// src/commands/run/editRepoRunList.ts
|
|
43733
43994
|
async function editRepoRunList(repoName, cwd, edit2) {
|
|
@@ -43898,7 +44159,7 @@ function saveProjectRunConfig(entry) {
|
|
|
43898
44159
|
saveConfig(config);
|
|
43899
44160
|
}
|
|
43900
44161
|
function createCommandFile(name) {
|
|
43901
|
-
const dir =
|
|
44162
|
+
const dir = join102(".claude", "commands");
|
|
43902
44163
|
mkdirSync35(dir, { recursive: true });
|
|
43903
44164
|
const content = `---
|
|
43904
44165
|
description: Run ${name}
|
|
@@ -43906,8 +44167,8 @@ description: Run ${name}
|
|
|
43906
44167
|
|
|
43907
44168
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
43908
44169
|
`;
|
|
43909
|
-
const filePath =
|
|
43910
|
-
|
|
44170
|
+
const filePath = join102(dir, `${name}.md`);
|
|
44171
|
+
writeFileSync53(filePath, content);
|
|
43911
44172
|
console.log(`Created command file: ${filePath}`);
|
|
43912
44173
|
}
|
|
43913
44174
|
async function add4() {
|
|
@@ -44012,7 +44273,7 @@ function registerRunAdd(runCommand) {
|
|
|
44012
44273
|
|
|
44013
44274
|
// src/commands/run/remove.ts
|
|
44014
44275
|
import { existsSync as existsSync84, unlinkSync as unlinkSync19 } from "fs";
|
|
44015
|
-
import { join as
|
|
44276
|
+
import { join as join103 } from "path";
|
|
44016
44277
|
|
|
44017
44278
|
// src/commands/run/removeRepoRunConfig.ts
|
|
44018
44279
|
function isNamed(entry, name) {
|
|
@@ -44030,7 +44291,7 @@ function removeRepoRunConfig(name, repoName, cwd = process.cwd()) {
|
|
|
44030
44291
|
|
|
44031
44292
|
// src/commands/run/remove.ts
|
|
44032
44293
|
function deleteCommandFile(name) {
|
|
44033
|
-
const filePath =
|
|
44294
|
+
const filePath = join103(".claude", "commands", `${name}.md`);
|
|
44034
44295
|
if (existsSync84(filePath)) {
|
|
44035
44296
|
unlinkSync19(filePath);
|
|
44036
44297
|
console.log(`Deleted command file: ${filePath}`);
|
|
@@ -44100,11 +44361,11 @@ function formatLink(link3) {
|
|
|
44100
44361
|
}
|
|
44101
44362
|
|
|
44102
44363
|
// src/commands/sessions/daemon/listDaemonPids.ts
|
|
44103
|
-
import { execFileSync as
|
|
44364
|
+
import { execFileSync as execFileSync33 } from "child_process";
|
|
44104
44365
|
function listDaemonPids() {
|
|
44105
44366
|
if (process.platform === "win32") return [];
|
|
44106
44367
|
try {
|
|
44107
|
-
const out =
|
|
44368
|
+
const out = execFileSync33("ps", ["-eo", "pid=,args="], {
|
|
44108
44369
|
encoding: "utf8"
|
|
44109
44370
|
});
|
|
44110
44371
|
return out.split("\n").filter((line) => line.includes("assist") && / daemon run\b/.test(line)).map((line) => Number.parseInt(line.trim(), 10)).filter((pid) => Number.isInteger(pid));
|
|
@@ -44566,7 +44827,7 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
|
|
|
44566
44827
|
|
|
44567
44828
|
// src/commands/sessions/daemon/findServerParents.ts
|
|
44568
44829
|
import { existsSync as existsSync86 } from "fs";
|
|
44569
|
-
import { join as
|
|
44830
|
+
import { join as join104, resolve as resolve29 } from "path";
|
|
44570
44831
|
function isLive(session) {
|
|
44571
44832
|
return !!session.pty && session.status !== "done" && session.status !== "error";
|
|
44572
44833
|
}
|
|
@@ -44575,7 +44836,7 @@ function isLiveAgent(session) {
|
|
|
44575
44836
|
}
|
|
44576
44837
|
function serverRunDirs(sessions, file) {
|
|
44577
44838
|
return new Set(
|
|
44578
|
-
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve29(s.cwd)).filter((dir) => existsSync86(
|
|
44839
|
+
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve29(s.cwd)).filter((dir) => existsSync86(join104(dir, file)))
|
|
44579
44840
|
);
|
|
44580
44841
|
}
|
|
44581
44842
|
function findServerParents(sessions, file) {
|
|
@@ -44793,7 +45054,7 @@ function sendResizeSnapshot(s, send) {
|
|
|
44793
45054
|
}
|
|
44794
45055
|
|
|
44795
45056
|
// src/commands/sessions/daemon/viewerSize.ts
|
|
44796
|
-
import { readFileSync as readFileSync67, writeFileSync as
|
|
45057
|
+
import { readFileSync as readFileSync67, writeFileSync as writeFileSync54 } from "fs";
|
|
44797
45058
|
var DEFAULT_SIZE = { cols: 120, rows: 30 };
|
|
44798
45059
|
var remembered;
|
|
44799
45060
|
function rememberViewerSize(cols, rows) {
|
|
@@ -44801,7 +45062,7 @@ function rememberViewerSize(cols, rows) {
|
|
|
44801
45062
|
if (remembered?.cols === cols && remembered.rows === rows) return;
|
|
44802
45063
|
remembered = { cols, rows };
|
|
44803
45064
|
try {
|
|
44804
|
-
|
|
45065
|
+
writeFileSync54(daemonPaths.viewerSize, JSON.stringify(remembered));
|
|
44805
45066
|
} catch (error) {
|
|
44806
45067
|
daemonLog(
|
|
44807
45068
|
`viewer size ${cols}x${rows} not saved: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -45436,13 +45697,13 @@ function createRunSession(id, { runName, runArgs, cwd, meta }) {
|
|
|
45436
45697
|
}
|
|
45437
45698
|
|
|
45438
45699
|
// src/commands/sessions/daemon/autoUpdate/autoUpdateControl.ts
|
|
45439
|
-
import { existsSync as existsSync90, rmSync as
|
|
45700
|
+
import { existsSync as existsSync90, rmSync as rmSync12, writeFileSync as writeFileSync55 } from "fs";
|
|
45440
45701
|
var paused;
|
|
45441
45702
|
var wake;
|
|
45442
45703
|
function persist2(value) {
|
|
45443
45704
|
try {
|
|
45444
|
-
if (value)
|
|
45445
|
-
else
|
|
45705
|
+
if (value) writeFileSync55(daemonPaths.autoUpdatePaused, "");
|
|
45706
|
+
else rmSync12(daemonPaths.autoUpdatePaused, { force: true });
|
|
45446
45707
|
} catch {
|
|
45447
45708
|
}
|
|
45448
45709
|
}
|
|
@@ -45566,7 +45827,7 @@ async function runAutoUpdateLoop(deps2, maxLaps = Number.POSITIVE_INFINITY) {
|
|
|
45566
45827
|
}
|
|
45567
45828
|
|
|
45568
45829
|
// src/commands/sessions/daemon/autoUpdate/trimWatcherLog.ts
|
|
45569
|
-
import { readFileSync as readFileSync69, writeFileSync as
|
|
45830
|
+
import { readFileSync as readFileSync69, writeFileSync as writeFileSync56 } from "fs";
|
|
45570
45831
|
var KEEP_TAIL = 256 * 1024;
|
|
45571
45832
|
var MAX_LOG_SIZE = 4 * 1024 * 1024;
|
|
45572
45833
|
function trimWatcherLog(cwd) {
|
|
@@ -45578,7 +45839,7 @@ function trimWatcherLog(cwd) {
|
|
|
45578
45839
|
return;
|
|
45579
45840
|
}
|
|
45580
45841
|
if (log2.length <= MAX_LOG_SIZE) return;
|
|
45581
|
-
|
|
45842
|
+
writeFileSync56(path108, log2.slice(-KEEP_TAIL));
|
|
45582
45843
|
daemonLog(`auto-update: log ${path108} trimmed to its last ${KEEP_TAIL} chars`);
|
|
45583
45844
|
}
|
|
45584
45845
|
|
|
@@ -45828,12 +46089,12 @@ function noteAutoUpdate(installDir, text17) {
|
|
|
45828
46089
|
|
|
45829
46090
|
// src/commands/sessions/daemon/autoUpdate/runUpdateLap.ts
|
|
45830
46091
|
import { spawn as spawn11 } from "child_process";
|
|
45831
|
-
import { rmSync as
|
|
46092
|
+
import { rmSync as rmSync13 } from "fs";
|
|
45832
46093
|
function clearLapSignals(cwd) {
|
|
45833
46094
|
const control = watchControlPaths(cwd);
|
|
45834
46095
|
if (!control) return;
|
|
45835
46096
|
for (const path108 of [control.check, control.stop])
|
|
45836
|
-
|
|
46097
|
+
rmSync13(path108, { force: true });
|
|
45837
46098
|
}
|
|
45838
46099
|
function runUpdateLap(cwd, onOutput) {
|
|
45839
46100
|
clearLapSignals(cwd);
|
|
@@ -45942,12 +46203,12 @@ import { basename as basename30 } from "path";
|
|
|
45942
46203
|
|
|
45943
46204
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
45944
46205
|
import { existsSync as existsSync92 } from "fs";
|
|
45945
|
-
import { join as
|
|
46206
|
+
import { join as join108 } from "path";
|
|
45946
46207
|
|
|
45947
46208
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
45948
46209
|
import { statSync as statSync15 } from "fs";
|
|
45949
46210
|
import { rm as rm3 } from "fs/promises";
|
|
45950
|
-
import { join as
|
|
46211
|
+
import { join as join107 } from "path";
|
|
45951
46212
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
45952
46213
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
45953
46214
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -45975,7 +46236,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
45975
46236
|
return { removed: true };
|
|
45976
46237
|
}
|
|
45977
46238
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
45978
|
-
return statSync15(
|
|
46239
|
+
return statSync15(join107(worktreePath, ".git"), {
|
|
45979
46240
|
throwIfNoEntry: false
|
|
45980
46241
|
})?.isDirectory() === true;
|
|
45981
46242
|
}
|
|
@@ -46011,7 +46272,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
46011
46272
|
);
|
|
46012
46273
|
}
|
|
46013
46274
|
function strandedReason(worktreePath, cause) {
|
|
46014
|
-
if (!existsSync92(
|
|
46275
|
+
if (!existsSync92(join108(worktreePath, ".git")))
|
|
46015
46276
|
return "its .git link is already gone";
|
|
46016
46277
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
46017
46278
|
return "git no longer recognises it as a working tree";
|
|
@@ -48385,7 +48646,7 @@ function releaseClient(client, clients, prPreview, verify) {
|
|
|
48385
48646
|
}
|
|
48386
48647
|
|
|
48387
48648
|
// src/commands/sessions/daemon/findPortHolderPid.ts
|
|
48388
|
-
import { execFileSync as
|
|
48649
|
+
import { execFileSync as execFileSync34 } from "child_process";
|
|
48389
48650
|
var PROBE_TIMEOUT_MS = 3e3;
|
|
48390
48651
|
function findPortHolderPid(port) {
|
|
48391
48652
|
try {
|
|
@@ -48395,7 +48656,7 @@ function findPortHolderPid(port) {
|
|
|
48395
48656
|
}
|
|
48396
48657
|
}
|
|
48397
48658
|
function probe(command, args) {
|
|
48398
|
-
return
|
|
48659
|
+
return execFileSync34(command, args, {
|
|
48399
48660
|
encoding: "utf8",
|
|
48400
48661
|
timeout: PROBE_TIMEOUT_MS,
|
|
48401
48662
|
stdio: ["ignore", "pipe", "ignore"]
|
|
@@ -48582,10 +48843,10 @@ function deferralNotice(persisted, cap2) {
|
|
|
48582
48843
|
|
|
48583
48844
|
// src/commands/sessions/daemon/worktree/underTempRoot.ts
|
|
48584
48845
|
import { realpathSync as realpathSync3 } from "fs";
|
|
48585
|
-
import { tmpdir as
|
|
48846
|
+
import { tmpdir as tmpdir8 } from "os";
|
|
48586
48847
|
import { sep as sep5 } from "path";
|
|
48587
48848
|
function tempRoots() {
|
|
48588
|
-
const raw =
|
|
48849
|
+
const raw = tmpdir8();
|
|
48589
48850
|
const roots = /* @__PURE__ */ new Set([raw]);
|
|
48590
48851
|
try {
|
|
48591
48852
|
roots.add(realpathSync3(raw));
|
|
@@ -50401,7 +50662,7 @@ import { existsSync as existsSync100 } from "fs";
|
|
|
50401
50662
|
|
|
50402
50663
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
50403
50664
|
import { copyFileSync as copyFileSync4, existsSync as existsSync99, mkdirSync as mkdirSync39 } from "fs";
|
|
50404
|
-
import { join as
|
|
50665
|
+
import { join as join109 } from "path";
|
|
50405
50666
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
50406
50667
|
const dir = projectDirForCwd(toCwd);
|
|
50407
50668
|
if (dir === projectDirForCwd(fromCwd)) {
|
|
@@ -50410,7 +50671,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
50410
50671
|
);
|
|
50411
50672
|
return;
|
|
50412
50673
|
}
|
|
50413
|
-
const dest =
|
|
50674
|
+
const dest = join109(dir, `${claudeSessionId}.jsonl`);
|
|
50414
50675
|
if (existsSync99(dest)) {
|
|
50415
50676
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
50416
50677
|
return;
|
|
@@ -50724,10 +50985,10 @@ function autoUpdateReply() {
|
|
|
50724
50985
|
}
|
|
50725
50986
|
|
|
50726
50987
|
// src/commands/sessions/daemon/autoUpdate/applyAutoUpdateAction.ts
|
|
50727
|
-
import { rmSync as
|
|
50988
|
+
import { rmSync as rmSync14, writeFileSync as writeFileSync57 } from "fs";
|
|
50728
50989
|
function signalLap(installDir, marker2) {
|
|
50729
50990
|
const control = watchControlPaths(installDir);
|
|
50730
|
-
if (control)
|
|
50991
|
+
if (control) writeFileSync57(control[marker2], "");
|
|
50731
50992
|
}
|
|
50732
50993
|
function applyAutoUpdateAction(action) {
|
|
50733
50994
|
const installDir = getInstallDir();
|
|
@@ -50735,7 +50996,7 @@ function applyAutoUpdateAction(action) {
|
|
|
50735
50996
|
if (action === "resume") {
|
|
50736
50997
|
if (!autoUpdateControl.paused()) return void 0;
|
|
50737
50998
|
const control = watchControlPaths(installDir);
|
|
50738
|
-
if (control)
|
|
50999
|
+
if (control) rmSync14(control.stop, { force: true });
|
|
50739
51000
|
autoUpdateControl.setPaused(false);
|
|
50740
51001
|
noteAutoUpdate(installDir, "resumed from Updates");
|
|
50741
51002
|
return void 0;
|
|
@@ -51659,7 +51920,7 @@ function handleConnection(socket, manager) {
|
|
|
51659
51920
|
}
|
|
51660
51921
|
|
|
51661
51922
|
// src/commands/sessions/daemon/onListening.ts
|
|
51662
|
-
import { unlinkSync as unlinkSync20, writeFileSync as
|
|
51923
|
+
import { unlinkSync as unlinkSync20, writeFileSync as writeFileSync58 } from "fs";
|
|
51663
51924
|
|
|
51664
51925
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
51665
51926
|
import { readFileSync as readFileSync70 } from "fs";
|
|
@@ -51681,7 +51942,7 @@ function ownsPidFile() {
|
|
|
51681
51942
|
|
|
51682
51943
|
// src/commands/sessions/daemon/onListening.ts
|
|
51683
51944
|
function onListening(manager, checkAutoExit) {
|
|
51684
|
-
|
|
51945
|
+
writeFileSync58(daemonPaths.pid, String(process.pid));
|
|
51685
51946
|
startPidFileWatchdog(() => {
|
|
51686
51947
|
daemonLog("lost daemon.pid ownership; shutting down sessions and exiting");
|
|
51687
51948
|
void manager.flushActiveMs().finally(() => {
|