@staff0rd/assist 0.664.0 → 0.665.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/README.md +1 -1
- package/dist/commands/sessions/web/bundle.js +425 -425
- package/dist/index.js +440 -243
- 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.665.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -6989,12 +6989,12 @@ function gitRefUrl(kind, ref, cwd) {
|
|
|
6989
6989
|
function buildBranchName({
|
|
6990
6990
|
prefix: prefix2,
|
|
6991
6991
|
jira,
|
|
6992
|
-
slug
|
|
6992
|
+
slug: slug2
|
|
6993
6993
|
}) {
|
|
6994
6994
|
const segments = [];
|
|
6995
6995
|
if (prefix2) segments.push(`${prefix2}/`);
|
|
6996
6996
|
if (jira) segments.push(`${jira}-`);
|
|
6997
|
-
segments.push(
|
|
6997
|
+
segments.push(slug2);
|
|
6998
6998
|
return segments.join("");
|
|
6999
6999
|
}
|
|
7000
7000
|
|
|
@@ -7018,7 +7018,7 @@ function resolveDefaultBranch(override, cwd) {
|
|
|
7018
7018
|
|
|
7019
7019
|
// src/commands/branch/createBranch.ts
|
|
7020
7020
|
async function createBranch({
|
|
7021
|
-
slug,
|
|
7021
|
+
slug: slug2,
|
|
7022
7022
|
jira,
|
|
7023
7023
|
from
|
|
7024
7024
|
}) {
|
|
@@ -7026,7 +7026,7 @@ async function createBranch({
|
|
|
7026
7026
|
const branchName = buildBranchName({
|
|
7027
7027
|
prefix: config.branch?.prefix,
|
|
7028
7028
|
jira,
|
|
7029
|
-
slug
|
|
7029
|
+
slug: slug2
|
|
7030
7030
|
});
|
|
7031
7031
|
execSync20("git fetch", { stdio: "inherit" });
|
|
7032
7032
|
let baseRef;
|
|
@@ -7085,11 +7085,11 @@ async function withSpinner(text18, task) {
|
|
|
7085
7085
|
var MAX_SLUG_WORDS = 5;
|
|
7086
7086
|
function deriveBranchSlug(name) {
|
|
7087
7087
|
const words = name.toLowerCase().replace(/[^a-z0-9]+/g, "-").split("-").filter((word) => word.length > 0).filter((word) => !/^\d+$/.test(word));
|
|
7088
|
-
const
|
|
7089
|
-
return
|
|
7088
|
+
const slug2 = words.slice(0, MAX_SLUG_WORDS).join("-");
|
|
7089
|
+
return slug2 || "story";
|
|
7090
7090
|
}
|
|
7091
|
-
function isConciseSlug(
|
|
7092
|
-
return
|
|
7091
|
+
function isConciseSlug(slug2) {
|
|
7092
|
+
return slug2.split("-").filter(Boolean).length <= MAX_SLUG_WORDS;
|
|
7093
7093
|
}
|
|
7094
7094
|
|
|
7095
7095
|
// src/commands/branch/generateBranchSlug.ts
|
|
@@ -7098,8 +7098,8 @@ async function generateBranchSlug(description) {
|
|
|
7098
7098
|
const fallback = deriveBranchSlug(description);
|
|
7099
7099
|
const suggestion = await requestSlug(description);
|
|
7100
7100
|
if (!suggestion) return fallback;
|
|
7101
|
-
const
|
|
7102
|
-
return
|
|
7101
|
+
const slug2 = deriveBranchSlug(suggestion);
|
|
7102
|
+
return slug2 === "story" ? fallback : slug2;
|
|
7103
7103
|
}
|
|
7104
7104
|
async function requestSlug(description) {
|
|
7105
7105
|
try {
|
|
@@ -7111,8 +7111,8 @@ async function requestSlug(description) {
|
|
|
7111
7111
|
{ encoding: "utf8", timeout: 3e4 }
|
|
7112
7112
|
)
|
|
7113
7113
|
);
|
|
7114
|
-
const
|
|
7115
|
-
return
|
|
7114
|
+
const slug2 = stdout.trim().split("\n")[0].replace(/^["'`]|["'`]$/g, "").trim();
|
|
7115
|
+
return slug2 || void 0;
|
|
7116
7116
|
} catch {
|
|
7117
7117
|
return void 0;
|
|
7118
7118
|
}
|
|
@@ -7154,8 +7154,8 @@ async function ensureStoryBranch(item) {
|
|
|
7154
7154
|
return;
|
|
7155
7155
|
}
|
|
7156
7156
|
process.env.ASSIST_BACKLOG_ITEM_ID = String(item.id);
|
|
7157
|
-
const
|
|
7158
|
-
const { branchName } = await createBranch({ slug, jira: item.jiraKey });
|
|
7157
|
+
const slug2 = await generateBranchSlug(item.name);
|
|
7158
|
+
const { branchName } = await createBranch({ slug: slug2, jira: item.jiraKey });
|
|
7159
7159
|
log(item, `prs.required set and no branch recorded; created ${branchName}`);
|
|
7160
7160
|
}
|
|
7161
7161
|
function recordedBranch(item) {
|
|
@@ -12563,10 +12563,64 @@ async function prList(req, res) {
|
|
|
12563
12563
|
respondJson(res, 200, { prs: await getOpenPrs(cwd) });
|
|
12564
12564
|
}
|
|
12565
12565
|
|
|
12566
|
-
// src/commands/sessions/web/
|
|
12566
|
+
// src/commands/sessions/web/ghAuthToken.ts
|
|
12567
12567
|
import { execFile as execFile6 } from "child_process";
|
|
12568
12568
|
import { promisify as promisify6 } from "util";
|
|
12569
12569
|
var execFileAsync5 = promisify6(execFile6);
|
|
12570
|
+
async function ghAuthToken(cwd) {
|
|
12571
|
+
const { stdout } = await execFileAsync5("gh", ["auth", "token"], {
|
|
12572
|
+
cwd,
|
|
12573
|
+
windowsHide: true
|
|
12574
|
+
});
|
|
12575
|
+
const token = stdout.trim();
|
|
12576
|
+
if (!token) throw new Error("gh auth token produced no token");
|
|
12577
|
+
return token;
|
|
12578
|
+
}
|
|
12579
|
+
|
|
12580
|
+
// src/commands/sessions/web/isUserAttachmentUrl.ts
|
|
12581
|
+
var USER_ATTACHMENT = /^https:\/\/github\.com\/user-attachments\/assets\/[A-Za-z0-9-]+$/;
|
|
12582
|
+
function isUserAttachmentUrl(url) {
|
|
12583
|
+
return USER_ATTACHMENT.test(url);
|
|
12584
|
+
}
|
|
12585
|
+
|
|
12586
|
+
// src/commands/sessions/web/previewImage.ts
|
|
12587
|
+
async function previewImage(req, res) {
|
|
12588
|
+
const url = new URL(req.url ?? "/", "http://localhost");
|
|
12589
|
+
const target = url.searchParams.get("url") ?? "";
|
|
12590
|
+
if (!isUserAttachmentUrl(target)) {
|
|
12591
|
+
respondJson(res, 400, { error: "Not a GitHub attachment url." });
|
|
12592
|
+
return;
|
|
12593
|
+
}
|
|
12594
|
+
let token;
|
|
12595
|
+
try {
|
|
12596
|
+
token = await ghAuthToken(url.searchParams.get("cwd") ?? void 0);
|
|
12597
|
+
} catch {
|
|
12598
|
+
respondJson(res, 502, { error: "Could not read a GitHub token." });
|
|
12599
|
+
return;
|
|
12600
|
+
}
|
|
12601
|
+
let location;
|
|
12602
|
+
try {
|
|
12603
|
+
const upstream = await fetch(target, {
|
|
12604
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
12605
|
+
redirect: "manual"
|
|
12606
|
+
});
|
|
12607
|
+
location = upstream.headers.get("location");
|
|
12608
|
+
} catch {
|
|
12609
|
+
respondJson(res, 502, { error: "Could not reach GitHub." });
|
|
12610
|
+
return;
|
|
12611
|
+
}
|
|
12612
|
+
if (!location) {
|
|
12613
|
+
respondJson(res, 404, { error: "Attachment is no longer available." });
|
|
12614
|
+
return;
|
|
12615
|
+
}
|
|
12616
|
+
res.writeHead(302, { Location: location, "Cache-Control": "no-store" });
|
|
12617
|
+
res.end();
|
|
12618
|
+
}
|
|
12619
|
+
|
|
12620
|
+
// src/commands/sessions/web/prStatus.ts
|
|
12621
|
+
import { execFile as execFile7 } from "child_process";
|
|
12622
|
+
import { promisify as promisify7 } from "util";
|
|
12623
|
+
var execFileAsync6 = promisify7(execFile7);
|
|
12570
12624
|
function toPrSummary(parsed) {
|
|
12571
12625
|
if (typeof parsed.number !== "number") return null;
|
|
12572
12626
|
return {
|
|
@@ -12596,7 +12650,7 @@ var getOpenPrForBranch = createCachedGhJson(
|
|
|
12596
12650
|
);
|
|
12597
12651
|
async function getCurrentBranch(cwd) {
|
|
12598
12652
|
try {
|
|
12599
|
-
const { stdout } = await
|
|
12653
|
+
const { stdout } = await execFileAsync6(
|
|
12600
12654
|
"git",
|
|
12601
12655
|
["rev-parse", "--abbrev-ref", "HEAD"],
|
|
12602
12656
|
{ encoding: "utf8", windowsHide: true, cwd: toGitCwd(cwd) }
|
|
@@ -13440,9 +13494,9 @@ function unsetConfig(req, res) {
|
|
|
13440
13494
|
import { rm } from "fs/promises";
|
|
13441
13495
|
|
|
13442
13496
|
// src/commands/sessions/web/runGhImage.ts
|
|
13443
|
-
import { execFile as
|
|
13444
|
-
import { promisify as
|
|
13445
|
-
var
|
|
13497
|
+
import { execFile as execFile8 } from "child_process";
|
|
13498
|
+
import { promisify as promisify8 } from "util";
|
|
13499
|
+
var execFileAsync7 = promisify8(execFile8);
|
|
13446
13500
|
var GhImageUnavailableError = class extends Error {
|
|
13447
13501
|
name = "GhImageUnavailableError";
|
|
13448
13502
|
};
|
|
@@ -13451,7 +13505,7 @@ var INSTALL_HINT = `Install the gh-image extension: ${GH_IMAGE_INSTALL_COMMAND}`
|
|
|
13451
13505
|
async function runGhImage(filePath, cwd) {
|
|
13452
13506
|
let stdout;
|
|
13453
13507
|
try {
|
|
13454
|
-
({ stdout } = await
|
|
13508
|
+
({ stdout } = await execFileAsync7("gh", ["image", filePath], {
|
|
13455
13509
|
cwd,
|
|
13456
13510
|
windowsHide: true,
|
|
13457
13511
|
maxBuffer: 10 * 1024 * 1024
|
|
@@ -13595,11 +13649,11 @@ async function uploadPrImage(req, res) {
|
|
|
13595
13649
|
import { readFile as readFile2, stat as stat3, writeFile as writeFile3 } from "fs/promises";
|
|
13596
13650
|
|
|
13597
13651
|
// src/commands/sessions/web/formatWithOxfmt.ts
|
|
13598
|
-
import { execFile as
|
|
13652
|
+
import { execFile as execFile9 } from "child_process";
|
|
13599
13653
|
import { existsSync as existsSync37 } from "fs";
|
|
13600
13654
|
import { dirname as dirname23, join as join35 } from "path";
|
|
13601
|
-
import { promisify as
|
|
13602
|
-
var
|
|
13655
|
+
import { promisify as promisify9 } from "util";
|
|
13656
|
+
var execFileAsync8 = promisify9(execFile9);
|
|
13603
13657
|
var TIMEOUT_MS = 15e3;
|
|
13604
13658
|
function findOxfmtScript(root) {
|
|
13605
13659
|
let dir = root;
|
|
@@ -13614,7 +13668,7 @@ function findOxfmtScript(root) {
|
|
|
13614
13668
|
async function formatWithOxfmt(target, root) {
|
|
13615
13669
|
const script = findOxfmtScript(root);
|
|
13616
13670
|
if (!script) return;
|
|
13617
|
-
await
|
|
13671
|
+
await execFileAsync8(process.execPath, [script, target], {
|
|
13618
13672
|
cwd: root,
|
|
13619
13673
|
windowsHide: true,
|
|
13620
13674
|
timeout: TIMEOUT_MS
|
|
@@ -13730,6 +13784,7 @@ var routes2 = {
|
|
|
13730
13784
|
"GET /api/backlog/summary": getBacklogSummary,
|
|
13731
13785
|
"POST /api/open-in-code": openInCode,
|
|
13732
13786
|
"POST /api/pr-preview/upload-image": uploadPrImage,
|
|
13787
|
+
"GET /api/pr-preview/image": previewImage,
|
|
13733
13788
|
"POST /api/restart": restartWeb,
|
|
13734
13789
|
"GET /api/github-url": githubUrl,
|
|
13735
13790
|
"GET /api/git-status": gitStatus,
|
|
@@ -14596,6 +14651,20 @@ function toSelection(value) {
|
|
|
14596
14651
|
return void 0;
|
|
14597
14652
|
return { topLeft: selection.topLeft, bottomRight: selection.bottomRight };
|
|
14598
14653
|
}
|
|
14654
|
+
function toChecklist(value) {
|
|
14655
|
+
if (!Array.isArray(value)) return void 0;
|
|
14656
|
+
return value.flatMap((entry) => {
|
|
14657
|
+
const { id, ticked, comment: comment3 } = entry ?? {};
|
|
14658
|
+
if (typeof id !== "string") return [];
|
|
14659
|
+
return [
|
|
14660
|
+
{
|
|
14661
|
+
id,
|
|
14662
|
+
ticked: ticked === true,
|
|
14663
|
+
...typeof comment3 === "string" && comment3 !== "" ? { comment: comment3 } : {}
|
|
14664
|
+
}
|
|
14665
|
+
];
|
|
14666
|
+
});
|
|
14667
|
+
}
|
|
14599
14668
|
function toPreviewDecision(msg) {
|
|
14600
14669
|
if (msg.decision !== "approve" && msg.decision !== "reject") return null;
|
|
14601
14670
|
return {
|
|
@@ -14608,7 +14677,8 @@ function toPreviewDecision(msg) {
|
|
|
14608
14677
|
announceAfter: msg.announceAfter === true,
|
|
14609
14678
|
draft: typeof msg.draft === "boolean" ? msg.draft : void 0,
|
|
14610
14679
|
autoMerge: msg.autoMerge === true,
|
|
14611
|
-
selection: toSelection(msg.selection)
|
|
14680
|
+
selection: toSelection(msg.selection),
|
|
14681
|
+
checklist: toChecklist(msg.checklist)
|
|
14612
14682
|
};
|
|
14613
14683
|
}
|
|
14614
14684
|
|
|
@@ -14668,7 +14738,7 @@ async function awaitPreviewApproval(subject, request, options2 = {}) {
|
|
|
14668
14738
|
process.exit(1);
|
|
14669
14739
|
}
|
|
14670
14740
|
if (decision.body !== void 0) options2.saveEditedBody?.(decision.body);
|
|
14671
|
-
if (decision.decision === "reject")
|
|
14741
|
+
if (decision.decision === "reject" && !options2.rejectIsOutcome)
|
|
14672
14742
|
reportPreviewRejection(subject, decision, options2.rejectionAdvice);
|
|
14673
14743
|
return decision;
|
|
14674
14744
|
}
|
|
@@ -15552,12 +15622,12 @@ async function link(fromId, toId, opts) {
|
|
|
15552
15622
|
const { orm } = await getReady();
|
|
15553
15623
|
const fromItem = await loadItem(orm, fromNum);
|
|
15554
15624
|
if (!fromItem) return void fail4(`Item ${from} not found.`);
|
|
15555
|
-
const
|
|
15556
|
-
if (!
|
|
15625
|
+
const toItem3 = await loadItem(orm, toNum);
|
|
15626
|
+
if (!toItem3) return void fail4(`Item ${to} not found.`);
|
|
15557
15627
|
if (!validateLinkTarget(fromItem, fromNum, toNum, linkType)) return;
|
|
15558
15628
|
if (await createsCycle(orm, linkType, fromNum, toNum)) return;
|
|
15559
15629
|
await orm.insert(links).values({ itemId: fromNum, type: linkType, targetId: toNum });
|
|
15560
|
-
console.log(chalk85.green(`Linked ${from} ${linkType} ${to} (${
|
|
15630
|
+
console.log(chalk85.green(`Linked ${from} ${linkType} ${to} (${toItem3.name})`));
|
|
15561
15631
|
}
|
|
15562
15632
|
|
|
15563
15633
|
// src/commands/backlog/unlink.ts
|
|
@@ -17089,27 +17159,27 @@ function registerBacklog(program2) {
|
|
|
17089
17159
|
var KEBAB_CASE_REGEX = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
17090
17160
|
var HASH_REF_REGEX = /#\d+/;
|
|
17091
17161
|
var BACKLOG_NUMBER_SEGMENT_REGEX = /(?:^|-)\d{1,4}(?:-|$)/;
|
|
17092
|
-
function validateSlug(
|
|
17093
|
-
if (!
|
|
17162
|
+
function validateSlug(slug2) {
|
|
17163
|
+
if (!slug2) {
|
|
17094
17164
|
return "Slug is required";
|
|
17095
17165
|
}
|
|
17096
|
-
if (HASH_REF_REGEX.test(
|
|
17097
|
-
return `Slug "${
|
|
17166
|
+
if (HASH_REF_REGEX.test(slug2)) {
|
|
17167
|
+
return `Slug "${slug2}" contains a backlog reference (#<number>); remove it`;
|
|
17098
17168
|
}
|
|
17099
|
-
if (!KEBAB_CASE_REGEX.test(
|
|
17100
|
-
return `Slug "${
|
|
17169
|
+
if (!KEBAB_CASE_REGEX.test(slug2)) {
|
|
17170
|
+
return `Slug "${slug2}" must be kebab-case (lowercase letters, digits, and hyphens)`;
|
|
17101
17171
|
}
|
|
17102
|
-
if (BACKLOG_NUMBER_SEGMENT_REGEX.test(
|
|
17103
|
-
return `Slug "${
|
|
17172
|
+
if (BACKLOG_NUMBER_SEGMENT_REGEX.test(slug2)) {
|
|
17173
|
+
return `Slug "${slug2}" contains a numeric token that looks like a backlog ID; remove or reword it`;
|
|
17104
17174
|
}
|
|
17105
17175
|
return null;
|
|
17106
17176
|
}
|
|
17107
17177
|
|
|
17108
17178
|
// src/commands/branch/branch.ts
|
|
17109
|
-
async function branch(
|
|
17110
|
-
const conciseSlug = isConciseSlug(
|
|
17111
|
-
if (conciseSlug !==
|
|
17112
|
-
console.log(`Shortened "${
|
|
17179
|
+
async function branch(slug2, options2) {
|
|
17180
|
+
const conciseSlug = isConciseSlug(slug2) ? slug2 : await generateBranchSlug(slug2);
|
|
17181
|
+
if (conciseSlug !== slug2) {
|
|
17182
|
+
console.log(`Shortened "${slug2}" to "${conciseSlug}"`);
|
|
17113
17183
|
}
|
|
17114
17184
|
const slugError = validateSlug(conciseSlug);
|
|
17115
17185
|
if (slugError) {
|
|
@@ -17140,7 +17210,7 @@ function registerBranch(program2) {
|
|
|
17140
17210
|
"--from <ref>",
|
|
17141
17211
|
"base the branch off <ref> verbatim (local branch, tag, or origin/*) instead of the fresh remote default"
|
|
17142
17212
|
).action(
|
|
17143
|
-
(
|
|
17213
|
+
(slug2, options2) => branch(slug2, options2)
|
|
17144
17214
|
);
|
|
17145
17215
|
configHelp(
|
|
17146
17216
|
branchCommand,
|
|
@@ -22534,11 +22604,11 @@ function printFixStructurePlan(plan2, chain2, apply) {
|
|
|
22534
22604
|
// src/commands/github/issue/parseRepoSlug.ts
|
|
22535
22605
|
var REPO_SLUG = /^([^/\s]+)\/([^/\s]+)$/;
|
|
22536
22606
|
function parseRepoSlug(repo) {
|
|
22537
|
-
const
|
|
22538
|
-
if (!
|
|
22607
|
+
const slug2 = REPO_SLUG.exec(repo.trim());
|
|
22608
|
+
if (!slug2) {
|
|
22539
22609
|
throw new Error(`--repo must be owner/repo, not "${repo}"`);
|
|
22540
22610
|
}
|
|
22541
|
-
return { owner:
|
|
22611
|
+
return { owner: slug2[1] ?? "", repo: slug2[2] ?? "" };
|
|
22542
22612
|
}
|
|
22543
22613
|
|
|
22544
22614
|
// src/commands/github/issue/fixStructure/resolveFixStructureTarget.ts
|
|
@@ -22546,8 +22616,8 @@ var BARE_NUMBER = /^#?(\d+)$/;
|
|
|
22546
22616
|
function resolveFixStructureTarget(target, repo) {
|
|
22547
22617
|
const shorthand = normalizeGithubIssue(target);
|
|
22548
22618
|
if (shorthand) {
|
|
22549
|
-
const [
|
|
22550
|
-
const [owner, name] = (
|
|
22619
|
+
const [slug2, number] = shorthand.split("#");
|
|
22620
|
+
const [owner, name] = (slug2 ?? "").split("/");
|
|
22551
22621
|
return { owner: owner ?? "", repo: name ?? "", number: Number(number) };
|
|
22552
22622
|
}
|
|
22553
22623
|
const bare = BARE_NUMBER.exec(target.trim());
|
|
@@ -23345,8 +23415,8 @@ import { existsSync as existsSync55, readFileSync as readFileSync39 } from "fs";
|
|
|
23345
23415
|
|
|
23346
23416
|
// src/commands/github/issue/issueWorkingFile.ts
|
|
23347
23417
|
import { join as join59 } from "path";
|
|
23348
|
-
function issueWorkingFile(
|
|
23349
|
-
const [owner = "unknown", repo = "unknown"] =
|
|
23418
|
+
function issueWorkingFile(slug2, number) {
|
|
23419
|
+
const [owner = "unknown", repo = "unknown"] = slug2.split("/");
|
|
23350
23420
|
const dir = join59(getStoreDir(), "github-issues", owner, repo);
|
|
23351
23421
|
return {
|
|
23352
23422
|
dir,
|
|
@@ -23356,8 +23426,8 @@ function issueWorkingFile(slug, number) {
|
|
|
23356
23426
|
}
|
|
23357
23427
|
|
|
23358
23428
|
// src/commands/github/issue/resumeIssueBody.ts
|
|
23359
|
-
function resumeIssueBody(
|
|
23360
|
-
const { bodyPath, metaPath } = issueWorkingFile(
|
|
23429
|
+
function resumeIssueBody(slug2, number, updatedAt) {
|
|
23430
|
+
const { bodyPath, metaPath } = issueWorkingFile(slug2, number);
|
|
23361
23431
|
if (!existsSync55(bodyPath) || !existsSync55(metaPath)) return void 0;
|
|
23362
23432
|
try {
|
|
23363
23433
|
const meta = JSON.parse(readFileSync39(metaPath, "utf8"));
|
|
@@ -23379,8 +23449,8 @@ function validateIssueBody(title, body) {
|
|
|
23379
23449
|
|
|
23380
23450
|
// src/commands/github/issue/writeIssueWorkingFile.ts
|
|
23381
23451
|
import { mkdirSync as mkdirSync16, writeFileSync as writeFileSync31 } from "fs";
|
|
23382
|
-
function writeIssueWorkingFile(
|
|
23383
|
-
const { dir, bodyPath, metaPath } = issueWorkingFile(
|
|
23452
|
+
function writeIssueWorkingFile(slug2, number, target, updatedAt, body) {
|
|
23453
|
+
const { dir, bodyPath, metaPath } = issueWorkingFile(slug2, number);
|
|
23384
23454
|
mkdirSync16(dir, { recursive: true });
|
|
23385
23455
|
writeFileSync31(bodyPath, body);
|
|
23386
23456
|
writeFileSync31(
|
|
@@ -23398,12 +23468,12 @@ function slugFromUrl(url) {
|
|
|
23398
23468
|
}
|
|
23399
23469
|
function prepareIssueEdit(number, repo, fresh) {
|
|
23400
23470
|
const issue = fetchIssue2(number, repo);
|
|
23401
|
-
const
|
|
23402
|
-
const target = `${
|
|
23403
|
-
const resumed = fresh ? void 0 : resumeIssueBody(
|
|
23471
|
+
const slug2 = repo ?? slugFromUrl(issue.url);
|
|
23472
|
+
const target = `${slug2}#${number}`;
|
|
23473
|
+
const resumed = fresh ? void 0 : resumeIssueBody(slug2, number, issue.updatedAt);
|
|
23404
23474
|
const body = resumed ?? issue.body;
|
|
23405
23475
|
validateIssueBody(issue.title, body);
|
|
23406
|
-
const save = (markdown) => writeIssueWorkingFile(
|
|
23476
|
+
const save = (markdown) => writeIssueWorkingFile(slug2, number, target, issue.updatedAt, markdown);
|
|
23407
23477
|
const bodyPath = save(body);
|
|
23408
23478
|
if (resumed !== void 0)
|
|
23409
23479
|
console.log(`Previewing the in-progress markdown from ${bodyPath}`);
|
|
@@ -24436,7 +24506,7 @@ function resolveInstallCommand(repoRoot2, install) {
|
|
|
24436
24506
|
}
|
|
24437
24507
|
|
|
24438
24508
|
// src/commands/sessions/daemon/worktree/stopInstall.ts
|
|
24439
|
-
import { execFile as
|
|
24509
|
+
import { execFile as execFile10 } from "child_process";
|
|
24440
24510
|
var running2 = /* @__PURE__ */ new Map();
|
|
24441
24511
|
function trackInstall(worktreePath, child) {
|
|
24442
24512
|
running2.set(worktreePath, child);
|
|
@@ -24455,7 +24525,7 @@ function stopInstall(worktreePath) {
|
|
|
24455
24525
|
}
|
|
24456
24526
|
function killTree(pid) {
|
|
24457
24527
|
if (process.platform === "win32") {
|
|
24458
|
-
|
|
24528
|
+
execFile10(
|
|
24459
24529
|
"taskkill",
|
|
24460
24530
|
["/T", "/F", "/PID", String(pid)],
|
|
24461
24531
|
{ windowsHide: true },
|
|
@@ -25796,12 +25866,12 @@ function buildMentionMap(rows, resolve25) {
|
|
|
25796
25866
|
visitObjects(rows, (o) => {
|
|
25797
25867
|
const url = profileActionUrl(o);
|
|
25798
25868
|
if (!url || o.children == null) return;
|
|
25799
|
-
const
|
|
25800
|
-
if (!
|
|
25869
|
+
const slug2 = slugFromProfileUrl(url);
|
|
25870
|
+
if (!slug2 || map.has(slug2)) return;
|
|
25801
25871
|
const sink3 = { text: [], hashtags: [] };
|
|
25802
25872
|
collectRscText(o.children, resolve25, sink3, /* @__PURE__ */ new Set());
|
|
25803
25873
|
const name = sink3.text.join(" ").replace(/\s+/g, " ").trim();
|
|
25804
|
-
map.set(
|
|
25874
|
+
map.set(slug2, name ? { slug: slug2, name, url } : { slug: slug2, url });
|
|
25805
25875
|
});
|
|
25806
25876
|
return map;
|
|
25807
25877
|
}
|
|
@@ -25848,16 +25918,16 @@ function linkifyMentions(text18, mentions) {
|
|
|
25848
25918
|
}
|
|
25849
25919
|
|
|
25850
25920
|
// src/commands/netcap/buildPost.ts
|
|
25851
|
-
var profileUrl = (
|
|
25921
|
+
var profileUrl = (slug2) => `https://www.linkedin.com/in/${slug2}/`;
|
|
25852
25922
|
var joinText = (parts) => parts.join(" ").replace(/\s+/g, " ").replace(/\s+([.,!?])/g, "$1").trim();
|
|
25853
25923
|
function resolveMentions(raw, mentionMap, author) {
|
|
25854
25924
|
const slugs = /* @__PURE__ */ new Set();
|
|
25855
25925
|
for (const url of raw.profileUrls) {
|
|
25856
|
-
const
|
|
25857
|
-
if (
|
|
25926
|
+
const slug2 = slugFromProfileUrl(url);
|
|
25927
|
+
if (slug2 && slug2 !== author) slugs.add(slug2);
|
|
25858
25928
|
}
|
|
25859
25929
|
return [...slugs].map(
|
|
25860
|
-
(
|
|
25930
|
+
(slug2) => mentionMap.get(slug2) ?? { slug: slug2, url: profileUrl(slug2) }
|
|
25861
25931
|
);
|
|
25862
25932
|
}
|
|
25863
25933
|
function resolveAuthor(mentionMap, author) {
|
|
@@ -25986,7 +26056,7 @@ function collectVoyagerAttributes(update3, profiles, authorSlug) {
|
|
|
25986
26056
|
}
|
|
25987
26057
|
|
|
25988
26058
|
// src/commands/netcap/resolveVoyagerAuthor.ts
|
|
25989
|
-
var profileUrl2 = (
|
|
26059
|
+
var profileUrl2 = (slug2) => `https://www.linkedin.com/in/${slug2}/`;
|
|
25990
26060
|
function profileSlug(actor) {
|
|
25991
26061
|
const target = asObject(actor?.navigationContext)?.actionTarget;
|
|
25992
26062
|
if (typeof target !== "string") return void 0;
|
|
@@ -25994,10 +26064,10 @@ function profileSlug(actor) {
|
|
|
25994
26064
|
}
|
|
25995
26065
|
function resolveVoyagerAuthor(update3) {
|
|
25996
26066
|
const actor = asObject(update3.actor);
|
|
25997
|
-
const
|
|
25998
|
-
if (!
|
|
26067
|
+
const slug2 = profileSlug(actor);
|
|
26068
|
+
if (!slug2) return void 0;
|
|
25999
26069
|
const name = asObject(actor?.name)?.text;
|
|
26000
|
-
const mention = { slug, url: profileUrl2(
|
|
26070
|
+
const mention = { slug: slug2, url: profileUrl2(slug2) };
|
|
26001
26071
|
if (typeof name === "string" && name.trim()) mention.name = name.trim();
|
|
26002
26072
|
return mention;
|
|
26003
26073
|
}
|
|
@@ -26037,7 +26107,7 @@ function buildVoyagerPost(update3, profiles) {
|
|
|
26037
26107
|
|
|
26038
26108
|
// src/commands/netcap/voyagerProfileMentions.ts
|
|
26039
26109
|
var PROFILE_TYPE = "com.linkedin.voyager.dash.identity.profile.Profile";
|
|
26040
|
-
var profileUrl3 = (
|
|
26110
|
+
var profileUrl3 = (slug2) => `https://www.linkedin.com/in/${slug2}/`;
|
|
26041
26111
|
function profileName(o) {
|
|
26042
26112
|
return [o.firstName, o.lastName].filter((s) => typeof s === "string" && s.length > 0).join(" ");
|
|
26043
26113
|
}
|
|
@@ -26045,12 +26115,12 @@ function voyagerProfileMentions(included) {
|
|
|
26045
26115
|
const map = /* @__PURE__ */ new Map();
|
|
26046
26116
|
for (const o of included) {
|
|
26047
26117
|
const urn = o.entityUrn;
|
|
26048
|
-
const
|
|
26118
|
+
const slug2 = o.publicIdentifier;
|
|
26049
26119
|
if (o.$type !== PROFILE_TYPE) continue;
|
|
26050
|
-
if (typeof urn !== "string" || typeof
|
|
26120
|
+
if (typeof urn !== "string" || typeof slug2 !== "string") continue;
|
|
26051
26121
|
const name = profileName(o);
|
|
26052
|
-
const url = profileUrl3(
|
|
26053
|
-
map.set(urn, name ? { slug, name, url } : { slug, url });
|
|
26122
|
+
const url = profileUrl3(slug2);
|
|
26123
|
+
map.set(urn, name ? { slug: slug2, name, url } : { slug: slug2, url });
|
|
26054
26124
|
}
|
|
26055
26125
|
return map;
|
|
26056
26126
|
}
|
|
@@ -30380,9 +30450,6 @@ async function checkoutOnlySession(number) {
|
|
|
30380
30450
|
await done2;
|
|
30381
30451
|
}
|
|
30382
30452
|
|
|
30383
|
-
// src/commands/review/highLevel/runHighLevelReview.ts
|
|
30384
|
-
import chalk213 from "chalk";
|
|
30385
|
-
|
|
30386
30453
|
// src/commands/review/fetchPrDiffInfo.ts
|
|
30387
30454
|
import { execSync as execSync58 } from "child_process";
|
|
30388
30455
|
function getCurrentBranch3() {
|
|
@@ -30590,6 +30657,105 @@ function evaluateHighLevelChecks(subject) {
|
|
|
30590
30657
|
});
|
|
30591
30658
|
}
|
|
30592
30659
|
|
|
30660
|
+
// src/commands/review/highLevel/fetchHighLevelPr.ts
|
|
30661
|
+
import { execSync as execSync59 } from "child_process";
|
|
30662
|
+
function fetchHighLevelPr(prNumber, repo) {
|
|
30663
|
+
const raw = execSync59(
|
|
30664
|
+
`gh pr view ${prNumber} --json body,headRefName,headRefOid -R ${repo.org}/${repo.repo}`,
|
|
30665
|
+
{ encoding: "utf8" }
|
|
30666
|
+
);
|
|
30667
|
+
const pr = JSON.parse(raw);
|
|
30668
|
+
return {
|
|
30669
|
+
body: pr.body ?? "",
|
|
30670
|
+
headRef: pr.headRefName,
|
|
30671
|
+
headSha: pr.headRefOid
|
|
30672
|
+
};
|
|
30673
|
+
}
|
|
30674
|
+
|
|
30675
|
+
// src/commands/review/highLevel/openHighLevelOverlay.ts
|
|
30676
|
+
import { randomUUID as randomUUID17 } from "crypto";
|
|
30677
|
+
|
|
30678
|
+
// src/commands/review/highLevel/buildHighLevelRecord.ts
|
|
30679
|
+
function toItem2(check2, decision) {
|
|
30680
|
+
const ticked = decision.checklist?.find((entry) => entry.id === check2.id);
|
|
30681
|
+
const comment3 = ticked?.comment?.trim();
|
|
30682
|
+
return {
|
|
30683
|
+
id: check2.id,
|
|
30684
|
+
kind: check2.kind,
|
|
30685
|
+
title: check2.title,
|
|
30686
|
+
status: check2.status,
|
|
30687
|
+
reason: check2.reason,
|
|
30688
|
+
ticked: ticked?.ticked ?? check2.status === "pass",
|
|
30689
|
+
...comment3 ? { comment: comment3 } : {}
|
|
30690
|
+
};
|
|
30691
|
+
}
|
|
30692
|
+
function buildHighLevelRecord(subject, decision) {
|
|
30693
|
+
const { checks: checks2, ...pr } = subject;
|
|
30694
|
+
return {
|
|
30695
|
+
...pr,
|
|
30696
|
+
verdict: decision.decision === "approve" ? "approve" : "request-changes",
|
|
30697
|
+
reviewedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
30698
|
+
items: checks2.map((check2) => toItem2(check2, decision))
|
|
30699
|
+
};
|
|
30700
|
+
}
|
|
30701
|
+
|
|
30702
|
+
// src/commands/review/highLevel/saveHighLevelReview.ts
|
|
30703
|
+
import { mkdirSync as mkdirSync21, writeFileSync as writeFileSync38 } from "fs";
|
|
30704
|
+
import { dirname as dirname34 } from "path";
|
|
30705
|
+
|
|
30706
|
+
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
30707
|
+
import { join as join75 } from "path";
|
|
30708
|
+
function slug(value) {
|
|
30709
|
+
return value.replace(/[^\w.-]+/g, "-");
|
|
30710
|
+
}
|
|
30711
|
+
function highLevelReviewPath(repo, headRef, headSha) {
|
|
30712
|
+
return join75(
|
|
30713
|
+
getStoreDir(),
|
|
30714
|
+
"high-level-reviews",
|
|
30715
|
+
slug(repo),
|
|
30716
|
+
`${slug(headRef)}-${headSha}.json`
|
|
30717
|
+
);
|
|
30718
|
+
}
|
|
30719
|
+
|
|
30720
|
+
// src/commands/review/highLevel/saveHighLevelReview.ts
|
|
30721
|
+
function saveHighLevelReview(record) {
|
|
30722
|
+
const path91 = highLevelReviewPath(record.repo, record.headRef, record.headSha);
|
|
30723
|
+
mkdirSync21(dirname34(path91), { recursive: true });
|
|
30724
|
+
writeFileSync38(path91, `${JSON.stringify(record, null, 2)}
|
|
30725
|
+
`);
|
|
30726
|
+
return path91;
|
|
30727
|
+
}
|
|
30728
|
+
|
|
30729
|
+
// src/commands/review/highLevel/openHighLevelOverlay.ts
|
|
30730
|
+
async function openHighLevelOverlay(sessionId, subject) {
|
|
30731
|
+
const decision = await awaitPreviewApproval(
|
|
30732
|
+
"High-level review",
|
|
30733
|
+
{
|
|
30734
|
+
sessionId,
|
|
30735
|
+
requestId: randomUUID17(),
|
|
30736
|
+
title: `High-level review of ${subject.repo}#${subject.prNumber}`,
|
|
30737
|
+
body: JSON.stringify(subject.checks),
|
|
30738
|
+
prNumber: subject.prNumber,
|
|
30739
|
+
kind: "high-level-review",
|
|
30740
|
+
metadata: [
|
|
30741
|
+
{ label: "Branch", value: subject.headRef },
|
|
30742
|
+
{ label: "Head", value: subject.headSha.slice(0, 7) },
|
|
30743
|
+
{ label: "Changed files", value: String(subject.changedFileCount) }
|
|
30744
|
+
]
|
|
30745
|
+
},
|
|
30746
|
+
{ rejectIsOutcome: true }
|
|
30747
|
+
);
|
|
30748
|
+
const record = buildHighLevelRecord(subject, decision);
|
|
30749
|
+
const path91 = saveHighLevelReview(record);
|
|
30750
|
+
console.log(`Verdict: ${record.verdict}`);
|
|
30751
|
+
console.log(`Saved ${path91}`);
|
|
30752
|
+
console.log("Nothing was posted to GitHub.");
|
|
30753
|
+
return record;
|
|
30754
|
+
}
|
|
30755
|
+
|
|
30756
|
+
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
30757
|
+
import chalk213 from "chalk";
|
|
30758
|
+
|
|
30593
30759
|
// src/commands/review/highLevel/formatHighLevelChecklist.ts
|
|
30594
30760
|
import chalk212 from "chalk";
|
|
30595
30761
|
var MARKERS = {
|
|
@@ -30627,6 +30793,25 @@ function formatHighLevelChecklist(checks2) {
|
|
|
30627
30793
|
].join("\n");
|
|
30628
30794
|
}
|
|
30629
30795
|
|
|
30796
|
+
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
30797
|
+
function printHighLevelChecklist(subject) {
|
|
30798
|
+
console.log(
|
|
30799
|
+
chalk213.bold(`High-level review of ${subject.repo}#${subject.prNumber}`),
|
|
30800
|
+
chalk213.dim(`\xB7 ${subject.changedFileCount} changed files`)
|
|
30801
|
+
);
|
|
30802
|
+
console.log(formatHighLevelChecklist(subject.checks));
|
|
30803
|
+
console.log(
|
|
30804
|
+
chalk213.dim(
|
|
30805
|
+
"\nManual items are for the reviewer to judge; see docs/high-level-review.md."
|
|
30806
|
+
)
|
|
30807
|
+
);
|
|
30808
|
+
console.log(
|
|
30809
|
+
chalk213.dim(
|
|
30810
|
+
"Run this inside an assist session to step through the checklist in the web overlay."
|
|
30811
|
+
)
|
|
30812
|
+
);
|
|
30813
|
+
}
|
|
30814
|
+
|
|
30630
30815
|
// src/commands/review/highLevel/resolveHighLevelConfig.ts
|
|
30631
30816
|
var DEFAULT_DESCRIPTION_WORD_CAP = 300;
|
|
30632
30817
|
function resolveHighLevelConfig(config) {
|
|
@@ -30648,23 +30833,30 @@ function resolvePrNumber2(number) {
|
|
|
30648
30833
|
}
|
|
30649
30834
|
return parsed;
|
|
30650
30835
|
}
|
|
30651
|
-
function
|
|
30836
|
+
function gather(number) {
|
|
30652
30837
|
const prNumber = resolvePrNumber2(number);
|
|
30653
30838
|
const { org, repo } = getRepoInfo();
|
|
30654
|
-
const
|
|
30655
|
-
const body = fetchPrBody(prNumber, { org, repo });
|
|
30839
|
+
const pr = fetchHighLevelPr(prNumber, { org, repo });
|
|
30656
30840
|
const changedFiles2 = fetchPrChangedFiles(prNumber);
|
|
30657
|
-
|
|
30658
|
-
|
|
30659
|
-
|
|
30660
|
-
|
|
30661
|
-
|
|
30662
|
-
|
|
30663
|
-
|
|
30664
|
-
|
|
30665
|
-
|
|
30666
|
-
|
|
30667
|
-
|
|
30841
|
+
return {
|
|
30842
|
+
repo: `${org}/${repo}`,
|
|
30843
|
+
prNumber,
|
|
30844
|
+
headRef: pr.headRef,
|
|
30845
|
+
headSha: pr.headSha,
|
|
30846
|
+
changedFileCount: changedFiles2.length,
|
|
30847
|
+
checks: evaluateHighLevelChecks({
|
|
30848
|
+
body: pr.body,
|
|
30849
|
+
changedFiles: changedFiles2,
|
|
30850
|
+
config: resolveHighLevelConfig(loadConfig())
|
|
30851
|
+
})
|
|
30852
|
+
};
|
|
30853
|
+
}
|
|
30854
|
+
async function runHighLevelReview(number) {
|
|
30855
|
+
const subject = gather(number);
|
|
30856
|
+
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
30857
|
+
if (process.env.ASSIST_SESSION !== "1" || !sessionId)
|
|
30858
|
+
return printHighLevelChecklist(subject);
|
|
30859
|
+
await openHighLevelOverlay(sessionId, subject);
|
|
30668
30860
|
}
|
|
30669
30861
|
|
|
30670
30862
|
// src/commands/review/annotateDiffWithLineNumbers.ts
|
|
@@ -30781,9 +30973,9 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
30781
30973
|
|
|
30782
30974
|
// src/commands/review/buildReviewPaths.ts
|
|
30783
30975
|
import { homedir as homedir23 } from "os";
|
|
30784
|
-
import { basename as basename20, join as
|
|
30976
|
+
import { basename as basename20, join as join76 } from "path";
|
|
30785
30977
|
function buildReviewPaths(repoRoot2, key) {
|
|
30786
|
-
const reviewDir =
|
|
30978
|
+
const reviewDir = join76(
|
|
30787
30979
|
homedir23(),
|
|
30788
30980
|
".assist",
|
|
30789
30981
|
"reviews",
|
|
@@ -30792,17 +30984,17 @@ function buildReviewPaths(repoRoot2, key) {
|
|
|
30792
30984
|
);
|
|
30793
30985
|
return {
|
|
30794
30986
|
reviewDir,
|
|
30795
|
-
requestPath:
|
|
30796
|
-
claudePath:
|
|
30797
|
-
codexPath:
|
|
30798
|
-
synthesisPath:
|
|
30987
|
+
requestPath: join76(reviewDir, "request.md"),
|
|
30988
|
+
claudePath: join76(reviewDir, "claude.md"),
|
|
30989
|
+
codexPath: join76(reviewDir, "codex.md"),
|
|
30990
|
+
synthesisPath: join76(reviewDir, "synthesis.md")
|
|
30799
30991
|
};
|
|
30800
30992
|
}
|
|
30801
30993
|
|
|
30802
30994
|
// src/commands/review/fetchExistingComments.ts
|
|
30803
|
-
import { execSync as
|
|
30995
|
+
import { execSync as execSync60 } from "child_process";
|
|
30804
30996
|
function fetchRawComments(org, repo, prNumber) {
|
|
30805
|
-
const out =
|
|
30997
|
+
const out = execSync60(
|
|
30806
30998
|
`gh api --paginate repos/${org}/${repo}/pulls/${prNumber}/comments`,
|
|
30807
30999
|
{ encoding: "utf8", maxBuffer: 64 * 1024 * 1024 }
|
|
30808
31000
|
);
|
|
@@ -30833,14 +31025,14 @@ function fetchExistingComments() {
|
|
|
30833
31025
|
}
|
|
30834
31026
|
|
|
30835
31027
|
// src/commands/review/gatherContext.ts
|
|
30836
|
-
import { execSync as
|
|
31028
|
+
import { execSync as execSync62 } from "child_process";
|
|
30837
31029
|
|
|
30838
31030
|
// src/commands/review/fetchPrDiff.ts
|
|
30839
|
-
import { execSync as
|
|
31031
|
+
import { execSync as execSync61 } from "child_process";
|
|
30840
31032
|
function fetchPrDiff(prNumber, baseSha, headSha) {
|
|
30841
31033
|
const { org, repo } = getRepoInfo();
|
|
30842
31034
|
try {
|
|
30843
|
-
return
|
|
31035
|
+
return execSync61(`gh pr diff ${prNumber} -R ${org}/${repo}`, {
|
|
30844
31036
|
encoding: "utf8",
|
|
30845
31037
|
maxBuffer: 256 * 1024 * 1024,
|
|
30846
31038
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -30855,10 +31047,10 @@ function isDiffTooLarge(error) {
|
|
|
30855
31047
|
}
|
|
30856
31048
|
function fetchDiffViaGit(baseSha, headSha) {
|
|
30857
31049
|
try {
|
|
30858
|
-
|
|
31050
|
+
execSync61(`git fetch origin ${baseSha} ${headSha}`, { stdio: "ignore" });
|
|
30859
31051
|
} catch {
|
|
30860
31052
|
}
|
|
30861
|
-
return
|
|
31053
|
+
return execSync61(`git diff ${baseSha}...${headSha}`, {
|
|
30862
31054
|
encoding: "utf8",
|
|
30863
31055
|
maxBuffer: 256 * 1024 * 1024
|
|
30864
31056
|
});
|
|
@@ -30866,11 +31058,11 @@ function fetchDiffViaGit(baseSha, headSha) {
|
|
|
30866
31058
|
|
|
30867
31059
|
// src/commands/review/gatherContext.ts
|
|
30868
31060
|
function gatherContext() {
|
|
30869
|
-
const branch2 =
|
|
31061
|
+
const branch2 = execSync62("git rev-parse --abbrev-ref HEAD", {
|
|
30870
31062
|
encoding: "utf8"
|
|
30871
31063
|
}).trim();
|
|
30872
|
-
const sha =
|
|
30873
|
-
const shortSha =
|
|
31064
|
+
const sha = execSync62("git rev-parse HEAD", { encoding: "utf8" }).trim();
|
|
31065
|
+
const shortSha = execSync62("git rev-parse --short=7 HEAD", {
|
|
30874
31066
|
encoding: "utf8"
|
|
30875
31067
|
}).trim();
|
|
30876
31068
|
const prInfo = fetchPrDiffInfo();
|
|
@@ -31478,16 +31670,16 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
|
|
|
31478
31670
|
}
|
|
31479
31671
|
|
|
31480
31672
|
// src/commands/review/prepareReviewDir.ts
|
|
31481
|
-
import { existsSync as existsSync63, mkdirSync as
|
|
31673
|
+
import { existsSync as existsSync63, mkdirSync as mkdirSync22, unlinkSync as unlinkSync17, writeFileSync as writeFileSync39 } from "fs";
|
|
31482
31674
|
function clearReviewFiles(paths) {
|
|
31483
31675
|
for (const path91 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
31484
31676
|
if (existsSync63(path91)) unlinkSync17(path91);
|
|
31485
31677
|
}
|
|
31486
31678
|
}
|
|
31487
31679
|
function prepareReviewDir(paths, requestBody, force) {
|
|
31488
|
-
|
|
31680
|
+
mkdirSync22(paths.reviewDir, { recursive: true });
|
|
31489
31681
|
if (force) clearReviewFiles(paths);
|
|
31490
|
-
|
|
31682
|
+
writeFileSync39(paths.requestPath, requestBody);
|
|
31491
31683
|
}
|
|
31492
31684
|
|
|
31493
31685
|
// src/commands/review/cachedReviewerResult.ts
|
|
@@ -31542,8 +31734,8 @@ function renderEntry(entry, frame) {
|
|
|
31542
31734
|
import { format } from "util";
|
|
31543
31735
|
|
|
31544
31736
|
// src/commands/review/createReviewLogSink.ts
|
|
31545
|
-
import { appendFileSync as appendFileSync2, mkdirSync as
|
|
31546
|
-
import { join as
|
|
31737
|
+
import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync23 } from "fs";
|
|
31738
|
+
import { join as join77 } from "path";
|
|
31547
31739
|
|
|
31548
31740
|
// src/shared/stripAnsi.ts
|
|
31549
31741
|
var ANSI = new RegExp(
|
|
@@ -31570,8 +31762,8 @@ function createReviewLogSink() {
|
|
|
31570
31762
|
`);
|
|
31571
31763
|
},
|
|
31572
31764
|
attach(reviewDir) {
|
|
31573
|
-
|
|
31574
|
-
logPath2 =
|
|
31765
|
+
mkdirSync23(reviewDir, { recursive: true });
|
|
31766
|
+
logPath2 = join77(reviewDir, LOG_FILE);
|
|
31575
31767
|
const lines2 = [
|
|
31576
31768
|
"",
|
|
31577
31769
|
`=== ${(/* @__PURE__ */ new Date()).toISOString()} ===`,
|
|
@@ -31860,7 +32052,7 @@ The review request is at: ${requestPath}
|
|
|
31860
32052
|
}
|
|
31861
32053
|
|
|
31862
32054
|
// src/commands/review/runClaudeReviewer.ts
|
|
31863
|
-
import { writeFileSync as
|
|
32055
|
+
import { writeFileSync as writeFileSync40 } from "fs";
|
|
31864
32056
|
|
|
31865
32057
|
// src/commands/review/finaliseReviewerSpinner.ts
|
|
31866
32058
|
var SUMMARY_MAX_LEN = 80;
|
|
@@ -32207,7 +32399,7 @@ async function runClaudeReviewer(spec) {
|
|
|
32207
32399
|
}
|
|
32208
32400
|
});
|
|
32209
32401
|
if (result.exitCode === 0 && finalText)
|
|
32210
|
-
|
|
32402
|
+
writeFileSync40(spec.outputPath, finalText);
|
|
32211
32403
|
return finaliseReviewerRun({ ...spec, command }, spinner, result);
|
|
32212
32404
|
}
|
|
32213
32405
|
|
|
@@ -32627,9 +32819,10 @@ async function review(options2 = {}) {
|
|
|
32627
32819
|
if (options2.checkoutOnly && options2.number)
|
|
32628
32820
|
return checkoutOnlySession(options2.number);
|
|
32629
32821
|
emitActivity({ kind: "command", name: "review" });
|
|
32630
|
-
if (options2.
|
|
32631
|
-
|
|
32822
|
+
if (!options2.number)
|
|
32823
|
+
return options2.highLevel ? runHighLevelReview(void 0) : reviewPr(invokedIn, options2);
|
|
32632
32824
|
await checkoutPr(options2.number);
|
|
32825
|
+
if (options2.highLevel) return runHighLevelReview(options2.number);
|
|
32633
32826
|
return reviewPr(resolveRepoRoot(), options2);
|
|
32634
32827
|
}
|
|
32635
32828
|
|
|
@@ -32663,7 +32856,7 @@ function registerReview(program2) {
|
|
|
32663
32856
|
"Check the PR out and start an idle interactive Claude session in the checkout tree instead of reviewing; requires a PR number and cannot be combined with --refine, --apply, --backlog or --submit"
|
|
32664
32857
|
).option(
|
|
32665
32858
|
"--high-level",
|
|
32666
|
-
"Skip the LLM review;
|
|
32859
|
+
"Skip the LLM review; check the PR branch out and step through the high-level review checklist in the web UI preview pane, writing the verdict, per-item state and comments to ~/.assist/high-level-reviews/. Nothing is posted to GitHub; cannot be combined with --refine, --apply, --backlog, --submit or --checkout-only"
|
|
32667
32860
|
).option(
|
|
32668
32861
|
"--address-comments",
|
|
32669
32862
|
"After posting and submitting the review, start an Address Comments session (assist review-pr-comments <n>) for the PR; no-op when nothing was posted or the review was not submitted, and only inside an assist session"
|
|
@@ -32684,7 +32877,7 @@ function registerReview(program2) {
|
|
|
32684
32877
|
}
|
|
32685
32878
|
|
|
32686
32879
|
// src/commands/rules/addRule.ts
|
|
32687
|
-
import { existsSync as existsSync68, readFileSync as readFileSync52, writeFileSync as
|
|
32880
|
+
import { existsSync as existsSync68, readFileSync as readFileSync52, writeFileSync as writeFileSync42 } from "fs";
|
|
32688
32881
|
import path72 from "path";
|
|
32689
32882
|
import chalk216 from "chalk";
|
|
32690
32883
|
|
|
@@ -32759,7 +32952,7 @@ function resolveRuleScope(target) {
|
|
|
32759
32952
|
}
|
|
32760
32953
|
|
|
32761
32954
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
32762
|
-
import { existsSync as existsSync67, readFileSync as readFileSync51, writeFileSync as
|
|
32955
|
+
import { existsSync as existsSync67, readFileSync as readFileSync51, writeFileSync as writeFileSync41 } from "fs";
|
|
32763
32956
|
import path71 from "path";
|
|
32764
32957
|
|
|
32765
32958
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
@@ -32811,7 +33004,7 @@ function updateScopedRulesIndex(root) {
|
|
|
32811
33004
|
const rootFile = path71.join(root, "CLAUDE.md");
|
|
32812
33005
|
const before = existsSync67(rootFile) ? readFileSync51(rootFile, "utf8") : "";
|
|
32813
33006
|
const after = upsertScopedRulesPointer(before, directories);
|
|
32814
|
-
if (after !== before)
|
|
33007
|
+
if (after !== before) writeFileSync41(rootFile, after);
|
|
32815
33008
|
return directories;
|
|
32816
33009
|
}
|
|
32817
33010
|
|
|
@@ -32830,7 +33023,7 @@ function addRule(text18, options2) {
|
|
|
32830
33023
|
const targetDir = path72.dirname(target);
|
|
32831
33024
|
const root = findRepoRoot(targetDir) ?? targetDir;
|
|
32832
33025
|
const code = nextRuleCode(root);
|
|
32833
|
-
|
|
33026
|
+
writeFileSync42(
|
|
32834
33027
|
target,
|
|
32835
33028
|
insertRuleBullet(read2(target), {
|
|
32836
33029
|
code,
|
|
@@ -33275,10 +33468,10 @@ function parseSlackThreadRef(value) {
|
|
|
33275
33468
|
}
|
|
33276
33469
|
|
|
33277
33470
|
// src/commands/slack/postSlackMessage.ts
|
|
33278
|
-
import { mkdirSync as
|
|
33471
|
+
import { mkdirSync as mkdirSync24, writeFileSync as writeFileSync43 } from "fs";
|
|
33279
33472
|
|
|
33280
33473
|
// src/commands/slack/reviewProposedSlackMessage.ts
|
|
33281
|
-
import { randomUUID as
|
|
33474
|
+
import { randomUUID as randomUUID18 } from "crypto";
|
|
33282
33475
|
async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
33283
33476
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
33284
33477
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
|
|
@@ -33287,7 +33480,7 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
33287
33480
|
"Slack message preview",
|
|
33288
33481
|
{
|
|
33289
33482
|
sessionId,
|
|
33290
|
-
requestId:
|
|
33483
|
+
requestId: randomUUID18(),
|
|
33291
33484
|
title: threadTs ? `Reply in ${channel} thread ${threadTs}` : `Post to ${channel}`,
|
|
33292
33485
|
body,
|
|
33293
33486
|
prNumber: null,
|
|
@@ -33300,11 +33493,11 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
33300
33493
|
}
|
|
33301
33494
|
|
|
33302
33495
|
// src/commands/slack/slackWorkingFile.ts
|
|
33303
|
-
import { join as
|
|
33496
|
+
import { join as join78 } from "path";
|
|
33304
33497
|
function slackWorkingFile(channel) {
|
|
33305
|
-
const
|
|
33306
|
-
const dir =
|
|
33307
|
-
return { dir, bodyPath:
|
|
33498
|
+
const slug2 = channel.replace(/^[#@]/, "").toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "channel";
|
|
33499
|
+
const dir = join78(getStoreDir(), "slack");
|
|
33500
|
+
return { dir, bodyPath: join78(dir, `${slug2}.md`) };
|
|
33308
33501
|
}
|
|
33309
33502
|
|
|
33310
33503
|
// src/commands/slack/postSlackMessage.ts
|
|
@@ -33325,8 +33518,8 @@ async function postSlackMessage(channelArg, options2) {
|
|
|
33325
33518
|
}
|
|
33326
33519
|
const threadTs = options2.thread;
|
|
33327
33520
|
const { dir, bodyPath } = slackWorkingFile(channel);
|
|
33328
|
-
|
|
33329
|
-
|
|
33521
|
+
mkdirSync24(dir, { recursive: true });
|
|
33522
|
+
writeFileSync43(bodyPath, `${body}
|
|
33330
33523
|
`);
|
|
33331
33524
|
await reviewProposedSlackMessage({ channel, threadTs }, body, bodyPath);
|
|
33332
33525
|
const target = threadTs ? `${channel} (thread_ts ${threadTs})` : channel;
|
|
@@ -34402,20 +34595,20 @@ async function configure() {
|
|
|
34402
34595
|
|
|
34403
34596
|
// src/commands/transcript/list.ts
|
|
34404
34597
|
import { existsSync as existsSync74, readdirSync as readdirSync21, statSync as statSync11 } from "fs";
|
|
34405
|
-
import { join as
|
|
34598
|
+
import { join as join89 } from "path";
|
|
34406
34599
|
function list4() {
|
|
34407
34600
|
const { vttDir } = getTranscriptConfig();
|
|
34408
34601
|
if (!existsSync74(vttDir)) return;
|
|
34409
34602
|
for (const entry of readdirSync21(vttDir)) {
|
|
34410
34603
|
if (!entry.endsWith(".vtt")) continue;
|
|
34411
|
-
if (statSync11(
|
|
34604
|
+
if (statSync11(join89(vttDir, entry)).isDirectory()) continue;
|
|
34412
34605
|
console.log(entry);
|
|
34413
34606
|
}
|
|
34414
34607
|
}
|
|
34415
34608
|
|
|
34416
34609
|
// src/commands/transcript/move.ts
|
|
34417
|
-
import { existsSync as existsSync75, mkdirSync as
|
|
34418
|
-
import { basename as basename23, join as
|
|
34610
|
+
import { existsSync as existsSync75, mkdirSync as mkdirSync30, renameSync as renameSync2, writeFileSync as writeFileSync47 } from "fs";
|
|
34611
|
+
import { basename as basename23, join as join90 } from "path";
|
|
34419
34612
|
|
|
34420
34613
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
34421
34614
|
function convertVttToMarkdown(inputPath) {
|
|
@@ -34425,9 +34618,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
34425
34618
|
// src/commands/transcript/move.ts
|
|
34426
34619
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
34427
34620
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
34428
|
-
const processedDir =
|
|
34429
|
-
|
|
34430
|
-
renameSync2(sourcePath,
|
|
34621
|
+
const processedDir = join90(vttDir, "processed");
|
|
34622
|
+
mkdirSync30(processedDir, { recursive: true });
|
|
34623
|
+
renameSync2(sourcePath, join90(processedDir, filename));
|
|
34431
34624
|
}
|
|
34432
34625
|
function move(file, options2) {
|
|
34433
34626
|
const { date, client } = options2;
|
|
@@ -34437,25 +34630,25 @@ function move(file, options2) {
|
|
|
34437
34630
|
}
|
|
34438
34631
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
34439
34632
|
const filename = basename23(file);
|
|
34440
|
-
const sourcePath =
|
|
34633
|
+
const sourcePath = join90(vttDir, filename);
|
|
34441
34634
|
if (!existsSync75(sourcePath)) {
|
|
34442
34635
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
34443
34636
|
process.exit(1);
|
|
34444
34637
|
}
|
|
34445
34638
|
const base = basename23(filename, ".vtt").replace(/ Transcription$/, "");
|
|
34446
34639
|
const outputName = `${date} ${base}.md`;
|
|
34447
|
-
const formattedDir =
|
|
34448
|
-
|
|
34449
|
-
const formattedPath =
|
|
34450
|
-
|
|
34640
|
+
const formattedDir = join90(transcriptsDir, client);
|
|
34641
|
+
mkdirSync30(formattedDir, { recursive: true });
|
|
34642
|
+
const formattedPath = join90(formattedDir, outputName);
|
|
34643
|
+
writeFileSync47(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
34451
34644
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
34452
|
-
const summaryPath =
|
|
34645
|
+
const summaryPath = join90(summaryDir, client, outputName);
|
|
34453
34646
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
34454
34647
|
console.log(`Summary target: ${summaryPath}`);
|
|
34455
34648
|
}
|
|
34456
34649
|
|
|
34457
34650
|
// src/commands/transcript/merge.ts
|
|
34458
|
-
import { existsSync as existsSync76, writeFileSync as
|
|
34651
|
+
import { existsSync as existsSync76, writeFileSync as writeFileSync48 } from "fs";
|
|
34459
34652
|
import { basename as basename24 } from "path";
|
|
34460
34653
|
|
|
34461
34654
|
// src/commands/transcript/failTranscript.ts
|
|
@@ -34632,7 +34825,7 @@ async function merge(files, options2 = {}) {
|
|
|
34632
34825
|
console.log(document);
|
|
34633
34826
|
return;
|
|
34634
34827
|
}
|
|
34635
|
-
|
|
34828
|
+
writeFileSync48(options2.out, `${document}
|
|
34636
34829
|
`, "utf8");
|
|
34637
34830
|
console.log(`Merged transcript: ${options2.out}`);
|
|
34638
34831
|
}
|
|
@@ -34768,38 +34961,38 @@ function registerVerify(program2) {
|
|
|
34768
34961
|
|
|
34769
34962
|
// src/commands/voice/devices.ts
|
|
34770
34963
|
import { spawnSync as spawnSync9 } from "child_process";
|
|
34771
|
-
import { join as
|
|
34964
|
+
import { join as join92 } from "path";
|
|
34772
34965
|
|
|
34773
34966
|
// src/commands/voice/shared.ts
|
|
34774
34967
|
import { homedir as homedir25 } from "os";
|
|
34775
|
-
import { dirname as
|
|
34968
|
+
import { dirname as dirname38, join as join91 } from "path";
|
|
34776
34969
|
import { fileURLToPath as fileURLToPath10 } from "url";
|
|
34777
|
-
var __dirname6 =
|
|
34778
|
-
var VOICE_DIR =
|
|
34970
|
+
var __dirname6 = dirname38(fileURLToPath10(import.meta.url));
|
|
34971
|
+
var VOICE_DIR = join91(homedir25(), ".assist", "voice");
|
|
34779
34972
|
var voicePaths = {
|
|
34780
34973
|
dir: VOICE_DIR,
|
|
34781
|
-
pid:
|
|
34782
|
-
log:
|
|
34783
|
-
venv:
|
|
34784
|
-
lock:
|
|
34974
|
+
pid: join91(VOICE_DIR, "voice.pid"),
|
|
34975
|
+
log: join91(VOICE_DIR, "voice.log"),
|
|
34976
|
+
venv: join91(VOICE_DIR, ".venv"),
|
|
34977
|
+
lock: join91(VOICE_DIR, "voice.lock")
|
|
34785
34978
|
};
|
|
34786
34979
|
function getPythonDir() {
|
|
34787
|
-
return
|
|
34980
|
+
return join91(__dirname6, "commands", "voice", "python");
|
|
34788
34981
|
}
|
|
34789
34982
|
function getVenvPython() {
|
|
34790
|
-
return process.platform === "win32" ?
|
|
34983
|
+
return process.platform === "win32" ? join91(voicePaths.venv, "Scripts", "python.exe") : join91(voicePaths.venv, "bin", "python");
|
|
34791
34984
|
}
|
|
34792
34985
|
function getLockDir() {
|
|
34793
34986
|
const config = loadConfig();
|
|
34794
34987
|
return config.voice?.lockDir ?? VOICE_DIR;
|
|
34795
34988
|
}
|
|
34796
34989
|
function getLockFile() {
|
|
34797
|
-
return
|
|
34990
|
+
return join91(getLockDir(), "voice.lock");
|
|
34798
34991
|
}
|
|
34799
34992
|
|
|
34800
34993
|
// src/commands/voice/devices.ts
|
|
34801
34994
|
function devices() {
|
|
34802
|
-
const script =
|
|
34995
|
+
const script = join92(getPythonDir(), "list_devices.py");
|
|
34803
34996
|
spawnSync9(getVenvPython(), [script], { stdio: "inherit" });
|
|
34804
34997
|
}
|
|
34805
34998
|
|
|
@@ -34833,13 +35026,13 @@ function logs(options2) {
|
|
|
34833
35026
|
|
|
34834
35027
|
// src/commands/voice/setup.ts
|
|
34835
35028
|
import { spawnSync as spawnSync10 } from "child_process";
|
|
34836
|
-
import { mkdirSync as
|
|
34837
|
-
import { join as
|
|
35029
|
+
import { mkdirSync as mkdirSync32 } from "fs";
|
|
35030
|
+
import { join as join94 } from "path";
|
|
34838
35031
|
|
|
34839
35032
|
// src/commands/voice/checkLockFile.ts
|
|
34840
|
-
import { execSync as
|
|
34841
|
-
import { existsSync as existsSync78, mkdirSync as
|
|
34842
|
-
import { join as
|
|
35033
|
+
import { execSync as execSync63 } from "child_process";
|
|
35034
|
+
import { existsSync as existsSync78, mkdirSync as mkdirSync31, readFileSync as readFileSync58, writeFileSync as writeFileSync49 } from "fs";
|
|
35035
|
+
import { join as join93 } from "path";
|
|
34843
35036
|
function isProcessAlive2(pid) {
|
|
34844
35037
|
try {
|
|
34845
35038
|
process.kill(pid, 0);
|
|
@@ -34866,7 +35059,7 @@ function bootstrapVenv() {
|
|
|
34866
35059
|
if (existsSync78(getVenvPython())) return;
|
|
34867
35060
|
console.log("Setting up Python environment...");
|
|
34868
35061
|
const pythonDir = getPythonDir();
|
|
34869
|
-
|
|
35062
|
+
execSync63(
|
|
34870
35063
|
`uv sync --project "${pythonDir}" --extra runtime --no-install-project`,
|
|
34871
35064
|
{
|
|
34872
35065
|
stdio: "inherit",
|
|
@@ -34876,8 +35069,8 @@ function bootstrapVenv() {
|
|
|
34876
35069
|
}
|
|
34877
35070
|
function writeLockFile(pid) {
|
|
34878
35071
|
const lockFile = getLockFile();
|
|
34879
|
-
|
|
34880
|
-
|
|
35072
|
+
mkdirSync31(join93(lockFile, ".."), { recursive: true });
|
|
35073
|
+
writeFileSync49(
|
|
34881
35074
|
lockFile,
|
|
34882
35075
|
JSON.stringify({
|
|
34883
35076
|
pid,
|
|
@@ -34889,10 +35082,10 @@ function writeLockFile(pid) {
|
|
|
34889
35082
|
|
|
34890
35083
|
// src/commands/voice/setup.ts
|
|
34891
35084
|
function setup() {
|
|
34892
|
-
|
|
35085
|
+
mkdirSync32(voicePaths.dir, { recursive: true });
|
|
34893
35086
|
bootstrapVenv();
|
|
34894
35087
|
console.log("\nDownloading models...\n");
|
|
34895
|
-
const script =
|
|
35088
|
+
const script = join94(getPythonDir(), "setup_models.py");
|
|
34896
35089
|
const result = spawnSync10(getVenvPython(), [script], {
|
|
34897
35090
|
stdio: "inherit",
|
|
34898
35091
|
env: { ...process.env, VOICE_LOG_FILE: voicePaths.log }
|
|
@@ -34905,8 +35098,8 @@ function setup() {
|
|
|
34905
35098
|
|
|
34906
35099
|
// src/commands/voice/start.ts
|
|
34907
35100
|
import { spawn as spawn8 } from "child_process";
|
|
34908
|
-
import { mkdirSync as
|
|
34909
|
-
import { join as
|
|
35101
|
+
import { mkdirSync as mkdirSync33, writeFileSync as writeFileSync50 } from "fs";
|
|
35102
|
+
import { join as join95 } from "path";
|
|
34910
35103
|
|
|
34911
35104
|
// src/commands/voice/buildDaemonEnv.ts
|
|
34912
35105
|
function buildDaemonEnv(options2) {
|
|
@@ -34934,17 +35127,17 @@ function spawnBackground(python, script, env) {
|
|
|
34934
35127
|
console.error("Failed to start voice daemon");
|
|
34935
35128
|
process.exit(1);
|
|
34936
35129
|
}
|
|
34937
|
-
|
|
35130
|
+
writeFileSync50(voicePaths.pid, String(pid));
|
|
34938
35131
|
writeLockFile(pid);
|
|
34939
35132
|
console.log(`Voice daemon started (PID ${pid})`);
|
|
34940
35133
|
}
|
|
34941
35134
|
function start2(options2) {
|
|
34942
|
-
|
|
35135
|
+
mkdirSync33(voicePaths.dir, { recursive: true });
|
|
34943
35136
|
checkLockFile();
|
|
34944
35137
|
bootstrapVenv();
|
|
34945
35138
|
const debug = options2.debug || options2.foreground || process.platform === "win32";
|
|
34946
35139
|
const env = buildDaemonEnv({ debug });
|
|
34947
|
-
const script =
|
|
35140
|
+
const script = join95(getPythonDir(), "voice_daemon.py");
|
|
34948
35141
|
const python = getVenvPython();
|
|
34949
35142
|
if (options2.foreground) {
|
|
34950
35143
|
spawnForeground(python, script, env);
|
|
@@ -35075,11 +35268,11 @@ function changedPaths(from, cwd) {
|
|
|
35075
35268
|
}
|
|
35076
35269
|
|
|
35077
35270
|
// src/commands/watch/readBuiltVersion.ts
|
|
35078
|
-
import { join as
|
|
35271
|
+
import { join as join96 } from "path";
|
|
35079
35272
|
function readBuiltVersion(cwd) {
|
|
35080
35273
|
try {
|
|
35081
35274
|
const root = runGit3(["rev-parse", "--show-toplevel"], cwd);
|
|
35082
|
-
return readPackageJson(
|
|
35275
|
+
return readPackageJson(join96(root, "package.json")).version ?? "unknown";
|
|
35083
35276
|
} catch {
|
|
35084
35277
|
return "unknown";
|
|
35085
35278
|
}
|
|
@@ -35436,13 +35629,13 @@ import { existsSync as existsSync83 } from "fs";
|
|
|
35436
35629
|
// src/commands/run/resolveCommand.ts
|
|
35437
35630
|
import { execFileSync as execFileSync18 } from "child_process";
|
|
35438
35631
|
import { existsSync as existsSync82 } from "fs";
|
|
35439
|
-
import { dirname as
|
|
35632
|
+
import { dirname as dirname39, join as join97, resolve as resolve20 } from "path";
|
|
35440
35633
|
function resolveCommand2(command) {
|
|
35441
35634
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
35442
35635
|
try {
|
|
35443
35636
|
const gitPath = execFileSync18("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
35444
|
-
const gitRoot = resolve20(
|
|
35445
|
-
const gitBash =
|
|
35637
|
+
const gitRoot = resolve20(dirname39(gitPath), "..");
|
|
35638
|
+
const gitBash = join97(gitRoot, "bin", "bash.exe");
|
|
35446
35639
|
if (existsSync82(gitBash)) return gitBash;
|
|
35447
35640
|
} catch {
|
|
35448
35641
|
return command;
|
|
@@ -35487,11 +35680,11 @@ function runCommandToCompletion(command, args, env, cwd, quiet) {
|
|
|
35487
35680
|
}
|
|
35488
35681
|
|
|
35489
35682
|
// src/commands/run/runPreCommands.ts
|
|
35490
|
-
import { execSync as
|
|
35683
|
+
import { execSync as execSync64 } from "child_process";
|
|
35491
35684
|
function runPreCommands(pre, cwd) {
|
|
35492
35685
|
for (const cmd of pre) {
|
|
35493
35686
|
try {
|
|
35494
|
-
|
|
35687
|
+
execSync64(cmd, { stdio: "inherit", cwd });
|
|
35495
35688
|
} catch (error) {
|
|
35496
35689
|
const code = error && typeof error === "object" && "status" in error ? error.status : 1;
|
|
35497
35690
|
process.exit(code);
|
|
@@ -35870,7 +36063,7 @@ async function auth() {
|
|
|
35870
36063
|
// src/commands/roam/postRoamActivity.ts
|
|
35871
36064
|
import { execFileSync as execFileSync20 } from "child_process";
|
|
35872
36065
|
import { readdirSync as readdirSync22, readFileSync as readFileSync61, statSync as statSync12 } from "fs";
|
|
35873
|
-
import { join as
|
|
36066
|
+
import { join as join98 } from "path";
|
|
35874
36067
|
function findPortFile(roamDir) {
|
|
35875
36068
|
let entries;
|
|
35876
36069
|
try {
|
|
@@ -35879,7 +36072,7 @@ function findPortFile(roamDir) {
|
|
|
35879
36072
|
return void 0;
|
|
35880
36073
|
}
|
|
35881
36074
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
35882
|
-
const path91 =
|
|
36075
|
+
const path91 = join98(roamDir, name);
|
|
35883
36076
|
try {
|
|
35884
36077
|
return { path: path91, mtimeMs: statSync12(path91).mtimeMs };
|
|
35885
36078
|
} catch {
|
|
@@ -35896,7 +36089,7 @@ var PID_BY_APP = {
|
|
|
35896
36089
|
function postRoamActivity(app, event) {
|
|
35897
36090
|
const appData = process.env.APPDATA;
|
|
35898
36091
|
if (!appData) return;
|
|
35899
|
-
const portFile = findPortFile(
|
|
36092
|
+
const portFile = findPortFile(join98(appData, "Roam"));
|
|
35900
36093
|
if (!portFile) return;
|
|
35901
36094
|
let port;
|
|
35902
36095
|
try {
|
|
@@ -36031,8 +36224,8 @@ async function run3(name, args) {
|
|
|
36031
36224
|
}
|
|
36032
36225
|
|
|
36033
36226
|
// src/commands/run/add.ts
|
|
36034
|
-
import { mkdirSync as
|
|
36035
|
-
import { join as
|
|
36227
|
+
import { mkdirSync as mkdirSync34, writeFileSync as writeFileSync51 } from "fs";
|
|
36228
|
+
import { join as join99 } from "path";
|
|
36036
36229
|
|
|
36037
36230
|
// src/commands/run/extractOption.ts
|
|
36038
36231
|
function extractOption(args, flag) {
|
|
@@ -36093,16 +36286,16 @@ function saveNewRunConfig(name, command, args, cwd) {
|
|
|
36093
36286
|
saveConfig(config);
|
|
36094
36287
|
}
|
|
36095
36288
|
function createCommandFile(name) {
|
|
36096
|
-
const dir =
|
|
36097
|
-
|
|
36289
|
+
const dir = join99(".claude", "commands");
|
|
36290
|
+
mkdirSync34(dir, { recursive: true });
|
|
36098
36291
|
const content = `---
|
|
36099
36292
|
description: Run ${name}
|
|
36100
36293
|
---
|
|
36101
36294
|
|
|
36102
36295
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
36103
36296
|
`;
|
|
36104
|
-
const filePath =
|
|
36105
|
-
|
|
36297
|
+
const filePath = join99(dir, `${name}.md`);
|
|
36298
|
+
writeFileSync51(filePath, content);
|
|
36106
36299
|
console.log(`Created command file: ${filePath}`);
|
|
36107
36300
|
}
|
|
36108
36301
|
function add3() {
|
|
@@ -36158,7 +36351,7 @@ function link2() {
|
|
|
36158
36351
|
|
|
36159
36352
|
// src/commands/run/remove.ts
|
|
36160
36353
|
import { existsSync as existsSync84, unlinkSync as unlinkSync21 } from "fs";
|
|
36161
|
-
import { join as
|
|
36354
|
+
import { join as join100 } from "path";
|
|
36162
36355
|
function findRemoveIndex() {
|
|
36163
36356
|
const idx = process.argv.indexOf("remove");
|
|
36164
36357
|
if (idx === -1 || idx + 1 >= process.argv.length) return -1;
|
|
@@ -36173,7 +36366,7 @@ function parseRemoveName() {
|
|
|
36173
36366
|
return process.argv[idx + 1];
|
|
36174
36367
|
}
|
|
36175
36368
|
function deleteCommandFile(name) {
|
|
36176
|
-
const filePath =
|
|
36369
|
+
const filePath = join100(".claude", "commands", `${name}.md`);
|
|
36177
36370
|
if (existsSync84(filePath)) {
|
|
36178
36371
|
unlinkSync21(filePath);
|
|
36179
36372
|
console.log(`Deleted command file: ${filePath}`);
|
|
@@ -36218,10 +36411,10 @@ function registerRun(program2) {
|
|
|
36218
36411
|
}
|
|
36219
36412
|
|
|
36220
36413
|
// src/commands/screenshot/index.ts
|
|
36221
|
-
import { execSync as
|
|
36222
|
-
import { existsSync as existsSync85, mkdirSync as
|
|
36414
|
+
import { execSync as execSync65 } from "child_process";
|
|
36415
|
+
import { existsSync as existsSync85, mkdirSync as mkdirSync35, unlinkSync as unlinkSync22, writeFileSync as writeFileSync52 } from "fs";
|
|
36223
36416
|
import { tmpdir as tmpdir9 } from "os";
|
|
36224
|
-
import { join as
|
|
36417
|
+
import { join as join101, resolve as resolve21 } from "path";
|
|
36225
36418
|
import chalk233 from "chalk";
|
|
36226
36419
|
|
|
36227
36420
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -36352,16 +36545,16 @@ Write-Output $OutputPath
|
|
|
36352
36545
|
// src/commands/screenshot/index.ts
|
|
36353
36546
|
function buildOutputPath(outputDir, processName) {
|
|
36354
36547
|
if (!existsSync85(outputDir)) {
|
|
36355
|
-
|
|
36548
|
+
mkdirSync35(outputDir, { recursive: true });
|
|
36356
36549
|
}
|
|
36357
36550
|
const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
36358
36551
|
return resolve21(outputDir, `${processName}-${timestamp6}.png`);
|
|
36359
36552
|
}
|
|
36360
36553
|
function runPowerShellScript(processName, outputPath) {
|
|
36361
|
-
const scriptPath =
|
|
36362
|
-
|
|
36554
|
+
const scriptPath = join101(tmpdir9(), `assist-screenshot-${Date.now()}.ps1`);
|
|
36555
|
+
writeFileSync52(scriptPath, captureWindowPs1, "utf8");
|
|
36363
36556
|
try {
|
|
36364
|
-
|
|
36557
|
+
execSync65(
|
|
36365
36558
|
`powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
|
|
36366
36559
|
{ stdio: ["ignore", "pipe", "pipe"], encoding: "utf8" }
|
|
36367
36560
|
);
|
|
@@ -36592,7 +36785,7 @@ function requestDrain(socket, lines2) {
|
|
|
36592
36785
|
}
|
|
36593
36786
|
|
|
36594
36787
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
36595
|
-
import { mkdirSync as
|
|
36788
|
+
import { mkdirSync as mkdirSync39 } from "fs";
|
|
36596
36789
|
|
|
36597
36790
|
// src/commands/sessions/daemon/createAutoExit.ts
|
|
36598
36791
|
var DEFAULT_GRACE_MS = 6e4;
|
|
@@ -36852,7 +37045,7 @@ var ClientHub = class extends Set {
|
|
|
36852
37045
|
};
|
|
36853
37046
|
|
|
36854
37047
|
// src/commands/sessions/daemon/createSession.ts
|
|
36855
|
-
import { randomUUID as
|
|
37048
|
+
import { randomUUID as randomUUID19 } from "crypto";
|
|
36856
37049
|
|
|
36857
37050
|
// src/commands/sessions/daemon/sessionBase.ts
|
|
36858
37051
|
function sessionBase(id, status3) {
|
|
@@ -37048,7 +37241,7 @@ function spawnRun(opts) {
|
|
|
37048
37241
|
function createSession(id, { prompt, cwd, design, auto, harness, holdPty } = {}) {
|
|
37049
37242
|
if (harness && harness !== "claude")
|
|
37050
37243
|
return createHarnessSession(id, harness, prompt, cwd, holdPty);
|
|
37051
|
-
const claudeSessionId =
|
|
37244
|
+
const claudeSessionId = randomUUID19();
|
|
37052
37245
|
return {
|
|
37053
37246
|
...sessionBase(id, prompt ? "running" : "waiting"),
|
|
37054
37247
|
name: `Session ${id}`,
|
|
@@ -37113,12 +37306,12 @@ import { basename as basename25 } from "path";
|
|
|
37113
37306
|
|
|
37114
37307
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
37115
37308
|
import { existsSync as existsSync89 } from "fs";
|
|
37116
|
-
import { join as
|
|
37309
|
+
import { join as join104 } from "path";
|
|
37117
37310
|
|
|
37118
37311
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
37119
37312
|
import { statSync as statSync14 } from "fs";
|
|
37120
37313
|
import { rm as rm4 } from "fs/promises";
|
|
37121
|
-
import { join as
|
|
37314
|
+
import { join as join103 } from "path";
|
|
37122
37315
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
37123
37316
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
37124
37317
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -37146,7 +37339,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
37146
37339
|
return { removed: true };
|
|
37147
37340
|
}
|
|
37148
37341
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
37149
|
-
return statSync14(
|
|
37342
|
+
return statSync14(join103(worktreePath, ".git"), {
|
|
37150
37343
|
throwIfNoEntry: false
|
|
37151
37344
|
})?.isDirectory() === true;
|
|
37152
37345
|
}
|
|
@@ -37182,7 +37375,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
37182
37375
|
);
|
|
37183
37376
|
}
|
|
37184
37377
|
function strandedReason(worktreePath, cause) {
|
|
37185
|
-
if (!existsSync89(
|
|
37378
|
+
if (!existsSync89(join104(worktreePath, ".git")))
|
|
37186
37379
|
return "its .git link is already gone";
|
|
37187
37380
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
37188
37381
|
return "git no longer recognises it as a working tree";
|
|
@@ -37617,8 +37810,9 @@ function decidePrPreview(sessions, waiters, notify2, d) {
|
|
|
37617
37810
|
}
|
|
37618
37811
|
const commentCount = Array.isArray(d.comments) ? d.comments.length : 0;
|
|
37619
37812
|
const screenshotCount = Array.isArray(d.screenshots) ? d.screenshots.length : 0;
|
|
37813
|
+
const checklistCount = Array.isArray(d.checklist) ? d.checklist.length : 0;
|
|
37620
37814
|
daemonLog(
|
|
37621
|
-
`pr-decision received: id=${id} requestId=${requestId} decision=${d.decision} comments=${commentCount} screenshots=${screenshotCount} reviewAfter=${d.reviewAfter === true} announceAfter=${d.announceAfter === true} draft=${d.draft} autoMerge=${d.autoMerge === true}`
|
|
37815
|
+
`pr-decision received: id=${id} requestId=${requestId} decision=${d.decision} comments=${commentCount} screenshots=${screenshotCount} checklist=${checklistCount} reviewAfter=${d.reviewAfter === true} announceAfter=${d.announceAfter === true} draft=${d.draft} autoMerge=${d.autoMerge === true}`
|
|
37622
37816
|
);
|
|
37623
37817
|
const waiter = waiters.get(id);
|
|
37624
37818
|
if (waiter)
|
|
@@ -37633,7 +37827,8 @@ function decidePrPreview(sessions, waiters, notify2, d) {
|
|
|
37633
37827
|
reviewAfter: d.reviewAfter,
|
|
37634
37828
|
announceAfter: d.announceAfter,
|
|
37635
37829
|
draft: d.draft,
|
|
37636
|
-
autoMerge: d.autoMerge
|
|
37830
|
+
autoMerge: d.autoMerge,
|
|
37831
|
+
checklist: d.checklist
|
|
37637
37832
|
});
|
|
37638
37833
|
waiters.delete(id);
|
|
37639
37834
|
session.pendingPrPreview = void 0;
|
|
@@ -37650,7 +37845,8 @@ var PREVIEW_KINDS = [
|
|
|
37650
37845
|
"github-issue-comment",
|
|
37651
37846
|
"github-issue-edit",
|
|
37652
37847
|
"miro-board",
|
|
37653
|
-
"slack-post"
|
|
37848
|
+
"slack-post",
|
|
37849
|
+
"high-level-review"
|
|
37654
37850
|
];
|
|
37655
37851
|
function isPreviewKind(value) {
|
|
37656
37852
|
return PREVIEW_KINDS.includes(value);
|
|
@@ -37675,6 +37871,7 @@ function previewTargetLabel(kind, itemType, prNumber, draft) {
|
|
|
37675
37871
|
if (kind === "github-issue") return "github issue";
|
|
37676
37872
|
if (kind === "miro-board") return "miro anchors";
|
|
37677
37873
|
if (kind === "slack-post") return "slack post";
|
|
37874
|
+
if (kind === "high-level-review") return "high-level review";
|
|
37678
37875
|
if (kind === "backlog-item") return `backlog ${itemType}`;
|
|
37679
37876
|
if (prNumber !== null) return `edit #${prNumber}`;
|
|
37680
37877
|
return draft ? "create draft" : "create";
|
|
@@ -37801,13 +37998,13 @@ function isBacklogItemId(text18) {
|
|
|
37801
37998
|
}
|
|
37802
37999
|
|
|
37803
38000
|
// src/commands/sessions/daemon/generateSessionTitle.ts
|
|
37804
|
-
import { execFile as
|
|
37805
|
-
import { promisify as
|
|
37806
|
-
var
|
|
38001
|
+
import { execFile as execFile11 } from "child_process";
|
|
38002
|
+
import { promisify as promisify10 } from "util";
|
|
38003
|
+
var execFileAsync9 = promisify10(execFile11);
|
|
37807
38004
|
var SESSION_TITLE_MAX_LENGTH = 48;
|
|
37808
38005
|
async function generateSessionTitle(prompt) {
|
|
37809
38006
|
try {
|
|
37810
|
-
const { stdout } = await
|
|
38007
|
+
const { stdout } = await execFileAsync9(
|
|
37811
38008
|
"claude",
|
|
37812
38009
|
["-p", "--model", "haiku", buildPrompt5(prompt)],
|
|
37813
38010
|
{ encoding: "utf8", windowsHide: true, timeout: 3e4 }
|
|
@@ -37940,8 +38137,8 @@ function handleFailedResume(session, exitCode, onStatusChange) {
|
|
|
37940
38137
|
}
|
|
37941
38138
|
|
|
37942
38139
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
37943
|
-
import { existsSync as existsSync93, mkdirSync as
|
|
37944
|
-
import { dirname as
|
|
38140
|
+
import { existsSync as existsSync93, mkdirSync as mkdirSync36, watch as watch2 } from "fs";
|
|
38141
|
+
import { dirname as dirname41 } from "path";
|
|
37945
38142
|
|
|
37946
38143
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
37947
38144
|
function applyActivityToSession(session, activity2) {
|
|
@@ -38003,9 +38200,9 @@ var DEBOUNCE_MS2 = 50;
|
|
|
38003
38200
|
function watchActivity(session, notify2, onClaudeSessionId) {
|
|
38004
38201
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
38005
38202
|
const path91 = activityPath(session.id);
|
|
38006
|
-
const dir =
|
|
38203
|
+
const dir = dirname41(path91);
|
|
38007
38204
|
try {
|
|
38008
|
-
|
|
38205
|
+
mkdirSync36(dir, { recursive: true });
|
|
38009
38206
|
} catch {
|
|
38010
38207
|
return;
|
|
38011
38208
|
}
|
|
@@ -38208,10 +38405,10 @@ function headContainsSessionId(filePath, claudeSessionId) {
|
|
|
38208
38405
|
}
|
|
38209
38406
|
|
|
38210
38407
|
// src/commands/sessions/daemon/ensureProjectDirExists.ts
|
|
38211
|
-
import { mkdirSync as
|
|
38408
|
+
import { mkdirSync as mkdirSync37 } from "fs";
|
|
38212
38409
|
function ensureProjectDirExists(dir, sessionId) {
|
|
38213
38410
|
try {
|
|
38214
|
-
|
|
38411
|
+
mkdirSync37(dir, { recursive: true });
|
|
38215
38412
|
return true;
|
|
38216
38413
|
} catch (error) {
|
|
38217
38414
|
daemonLog(
|
|
@@ -39160,7 +39357,7 @@ function codexRespawnPlan(session) {
|
|
|
39160
39357
|
}
|
|
39161
39358
|
|
|
39162
39359
|
// src/commands/sessions/daemon/interactiveRespawnPlan.ts
|
|
39163
|
-
import { randomUUID as
|
|
39360
|
+
import { randomUUID as randomUUID20 } from "crypto";
|
|
39164
39361
|
function interactiveRespawnPlan(session, resumes) {
|
|
39165
39362
|
const { claudeSessionId, cwd, initialPrompt, design, auto } = session;
|
|
39166
39363
|
if (!resumes) return null;
|
|
@@ -39180,7 +39377,7 @@ function interactiveRespawnPlan(session, resumes) {
|
|
|
39180
39377
|
return null;
|
|
39181
39378
|
}
|
|
39182
39379
|
function freshClaudePlan(session, prompt, cwd) {
|
|
39183
|
-
const claudeSessionId =
|
|
39380
|
+
const claudeSessionId = randomUUID20();
|
|
39184
39381
|
return {
|
|
39185
39382
|
spawn: () => {
|
|
39186
39383
|
session.claudeSessionId = claudeSessionId;
|
|
@@ -40137,10 +40334,10 @@ function startReusedRunPty(session, assistArgs, itemId2, hold, clients, onStatus
|
|
|
40137
40334
|
}
|
|
40138
40335
|
|
|
40139
40336
|
// src/commands/sessions/daemon/createWatcherSession.ts
|
|
40140
|
-
import { randomUUID as
|
|
40337
|
+
import { randomUUID as randomUUID21 } from "crypto";
|
|
40141
40338
|
var WATCH_PROMPT = "/watch";
|
|
40142
40339
|
function createWatcherSession(id, cwd) {
|
|
40143
|
-
const claudeSessionId =
|
|
40340
|
+
const claudeSessionId = randomUUID21();
|
|
40144
40341
|
return {
|
|
40145
40342
|
...sessionBase(id, "running"),
|
|
40146
40343
|
name: `Session ${id}`,
|
|
@@ -41391,8 +41588,8 @@ function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
|
41391
41588
|
import { existsSync as existsSync99 } from "fs";
|
|
41392
41589
|
|
|
41393
41590
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
41394
|
-
import { copyFileSync as copyFileSync5, existsSync as existsSync98, mkdirSync as
|
|
41395
|
-
import { join as
|
|
41591
|
+
import { copyFileSync as copyFileSync5, existsSync as existsSync98, mkdirSync as mkdirSync38 } from "fs";
|
|
41592
|
+
import { join as join106 } from "path";
|
|
41396
41593
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
41397
41594
|
const dir = projectDirForCwd(toCwd);
|
|
41398
41595
|
if (dir === projectDirForCwd(fromCwd)) {
|
|
@@ -41401,7 +41598,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
41401
41598
|
);
|
|
41402
41599
|
return;
|
|
41403
41600
|
}
|
|
41404
|
-
const dest =
|
|
41601
|
+
const dest = join106(dir, `${claudeSessionId}.jsonl`);
|
|
41405
41602
|
if (existsSync98(dest)) {
|
|
41406
41603
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
41407
41604
|
return;
|
|
@@ -41414,7 +41611,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
41414
41611
|
return;
|
|
41415
41612
|
}
|
|
41416
41613
|
try {
|
|
41417
|
-
|
|
41614
|
+
mkdirSync38(dir, { recursive: true });
|
|
41418
41615
|
copyFileSync5(source, dest);
|
|
41419
41616
|
daemonLog(
|
|
41420
41617
|
`transcript ${source} copied to ${dest} so ${toCwd} can resume it`
|
|
@@ -42045,7 +42242,7 @@ function handleConnection(socket, manager) {
|
|
|
42045
42242
|
}
|
|
42046
42243
|
|
|
42047
42244
|
// src/commands/sessions/daemon/onListening.ts
|
|
42048
|
-
import { unlinkSync as unlinkSync23, writeFileSync as
|
|
42245
|
+
import { unlinkSync as unlinkSync23, writeFileSync as writeFileSync53 } from "fs";
|
|
42049
42246
|
|
|
42050
42247
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
42051
42248
|
import { readFileSync as readFileSync65 } from "fs";
|
|
@@ -42067,7 +42264,7 @@ function ownsPidFile() {
|
|
|
42067
42264
|
|
|
42068
42265
|
// src/commands/sessions/daemon/onListening.ts
|
|
42069
42266
|
function onListening(manager, checkAutoExit) {
|
|
42070
|
-
|
|
42267
|
+
writeFileSync53(daemonPaths.pid, String(process.pid));
|
|
42071
42268
|
startPidFileWatchdog(() => {
|
|
42072
42269
|
daemonLog("lost daemon.pid ownership; shutting down sessions and exiting");
|
|
42073
42270
|
void manager.flushActiveMs().finally(() => {
|
|
@@ -42254,7 +42451,7 @@ async function recoverFromAddrInUse(server, manager, checkAutoExit) {
|
|
|
42254
42451
|
|
|
42255
42452
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
42256
42453
|
async function runDaemon() {
|
|
42257
|
-
|
|
42454
|
+
mkdirSync39(daemonPaths.dir, { recursive: true });
|
|
42258
42455
|
daemonLog(
|
|
42259
42456
|
`starting (reason: ${process.env.ASSIST_DAEMON_SPAWN_REASON ?? "manual"})`
|
|
42260
42457
|
);
|
|
@@ -42553,9 +42750,9 @@ function buildLimitsSegment(rateLimits) {
|
|
|
42553
42750
|
|
|
42554
42751
|
// src/commands/readGitBranch.ts
|
|
42555
42752
|
import { readFileSync as readFileSync67, statSync as statSync16 } from "fs";
|
|
42556
|
-
import { isAbsolute as isAbsolute5, join as
|
|
42753
|
+
import { isAbsolute as isAbsolute5, join as join107, resolve as resolve23 } from "path";
|
|
42557
42754
|
function resolveGitDir(cwd) {
|
|
42558
|
-
const dotGit =
|
|
42755
|
+
const dotGit = join107(cwd, ".git");
|
|
42559
42756
|
let stat4;
|
|
42560
42757
|
try {
|
|
42561
42758
|
stat4 = statSync16(dotGit);
|
|
@@ -42585,7 +42782,7 @@ function readGitBranch(cwd) {
|
|
|
42585
42782
|
}
|
|
42586
42783
|
let head;
|
|
42587
42784
|
try {
|
|
42588
|
-
head = readFileSync67(
|
|
42785
|
+
head = readFileSync67(join107(gitDir, "HEAD"), "utf8");
|
|
42589
42786
|
} catch {
|
|
42590
42787
|
return null;
|
|
42591
42788
|
}
|
|
@@ -42653,7 +42850,7 @@ async function statusLine() {
|
|
|
42653
42850
|
}
|
|
42654
42851
|
|
|
42655
42852
|
// src/commands/update.ts
|
|
42656
|
-
import { execSync as
|
|
42853
|
+
import { execSync as execSync66 } from "child_process";
|
|
42657
42854
|
import * as path90 from "path";
|
|
42658
42855
|
|
|
42659
42856
|
// src/commands/restartDaemonAfterUpdate.ts
|
|
@@ -42677,7 +42874,7 @@ function isGlobalNpmInstall(dir) {
|
|
|
42677
42874
|
if (resolved.split(path90.sep).includes("node_modules")) {
|
|
42678
42875
|
return true;
|
|
42679
42876
|
}
|
|
42680
|
-
const globalPrefix =
|
|
42877
|
+
const globalPrefix = execSync66("npm prefix -g", { stdio: "pipe" }).toString().trim();
|
|
42681
42878
|
return resolved.toLowerCase().startsWith(path90.resolve(globalPrefix).toLowerCase());
|
|
42682
42879
|
} catch {
|
|
42683
42880
|
return false;
|
|
@@ -42688,18 +42885,18 @@ async function update2() {
|
|
|
42688
42885
|
console.log(`Assist is installed at: ${installDir}`);
|
|
42689
42886
|
if (isGitRepo(installDir)) {
|
|
42690
42887
|
console.log("Detected git repo installation, pulling latest...");
|
|
42691
|
-
|
|
42888
|
+
execSync66("git pull", { cwd: installDir, stdio: "inherit" });
|
|
42692
42889
|
console.log("Installing dependencies...");
|
|
42693
|
-
|
|
42890
|
+
execSync66("npm i", { cwd: installDir, stdio: "inherit" });
|
|
42694
42891
|
console.log("Building...");
|
|
42695
|
-
|
|
42892
|
+
execSync66("npm run build", { cwd: installDir, stdio: "inherit" });
|
|
42696
42893
|
console.log("Syncing commands...");
|
|
42697
|
-
|
|
42894
|
+
execSync66("assist sync", { stdio: "inherit" });
|
|
42698
42895
|
} else if (isGlobalNpmInstall(installDir)) {
|
|
42699
42896
|
console.log("Detected global npm installation, updating...");
|
|
42700
|
-
|
|
42897
|
+
execSync66("npm i -g @staff0rd/assist@latest", { stdio: "inherit" });
|
|
42701
42898
|
console.log("Syncing commands...");
|
|
42702
|
-
|
|
42899
|
+
execSync66("assist sync", { stdio: "inherit" });
|
|
42703
42900
|
} else {
|
|
42704
42901
|
console.error(
|
|
42705
42902
|
"Could not determine installation method. Expected a git repo or global npm install."
|