@staff0rd/assist 0.664.0 → 0.665.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/commands/sessions/web/bundle.js +425 -425
- package/dist/index.js +369 -227
- 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.0",
|
|
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) {
|
|
@@ -14596,6 +14596,20 @@ function toSelection(value) {
|
|
|
14596
14596
|
return void 0;
|
|
14597
14597
|
return { topLeft: selection.topLeft, bottomRight: selection.bottomRight };
|
|
14598
14598
|
}
|
|
14599
|
+
function toChecklist(value) {
|
|
14600
|
+
if (!Array.isArray(value)) return void 0;
|
|
14601
|
+
return value.flatMap((entry) => {
|
|
14602
|
+
const { id, ticked, comment: comment3 } = entry ?? {};
|
|
14603
|
+
if (typeof id !== "string") return [];
|
|
14604
|
+
return [
|
|
14605
|
+
{
|
|
14606
|
+
id,
|
|
14607
|
+
ticked: ticked === true,
|
|
14608
|
+
...typeof comment3 === "string" && comment3 !== "" ? { comment: comment3 } : {}
|
|
14609
|
+
}
|
|
14610
|
+
];
|
|
14611
|
+
});
|
|
14612
|
+
}
|
|
14599
14613
|
function toPreviewDecision(msg) {
|
|
14600
14614
|
if (msg.decision !== "approve" && msg.decision !== "reject") return null;
|
|
14601
14615
|
return {
|
|
@@ -14608,7 +14622,8 @@ function toPreviewDecision(msg) {
|
|
|
14608
14622
|
announceAfter: msg.announceAfter === true,
|
|
14609
14623
|
draft: typeof msg.draft === "boolean" ? msg.draft : void 0,
|
|
14610
14624
|
autoMerge: msg.autoMerge === true,
|
|
14611
|
-
selection: toSelection(msg.selection)
|
|
14625
|
+
selection: toSelection(msg.selection),
|
|
14626
|
+
checklist: toChecklist(msg.checklist)
|
|
14612
14627
|
};
|
|
14613
14628
|
}
|
|
14614
14629
|
|
|
@@ -14668,7 +14683,7 @@ async function awaitPreviewApproval(subject, request, options2 = {}) {
|
|
|
14668
14683
|
process.exit(1);
|
|
14669
14684
|
}
|
|
14670
14685
|
if (decision.body !== void 0) options2.saveEditedBody?.(decision.body);
|
|
14671
|
-
if (decision.decision === "reject")
|
|
14686
|
+
if (decision.decision === "reject" && !options2.rejectIsOutcome)
|
|
14672
14687
|
reportPreviewRejection(subject, decision, options2.rejectionAdvice);
|
|
14673
14688
|
return decision;
|
|
14674
14689
|
}
|
|
@@ -15552,12 +15567,12 @@ async function link(fromId, toId, opts) {
|
|
|
15552
15567
|
const { orm } = await getReady();
|
|
15553
15568
|
const fromItem = await loadItem(orm, fromNum);
|
|
15554
15569
|
if (!fromItem) return void fail4(`Item ${from} not found.`);
|
|
15555
|
-
const
|
|
15556
|
-
if (!
|
|
15570
|
+
const toItem3 = await loadItem(orm, toNum);
|
|
15571
|
+
if (!toItem3) return void fail4(`Item ${to} not found.`);
|
|
15557
15572
|
if (!validateLinkTarget(fromItem, fromNum, toNum, linkType)) return;
|
|
15558
15573
|
if (await createsCycle(orm, linkType, fromNum, toNum)) return;
|
|
15559
15574
|
await orm.insert(links).values({ itemId: fromNum, type: linkType, targetId: toNum });
|
|
15560
|
-
console.log(chalk85.green(`Linked ${from} ${linkType} ${to} (${
|
|
15575
|
+
console.log(chalk85.green(`Linked ${from} ${linkType} ${to} (${toItem3.name})`));
|
|
15561
15576
|
}
|
|
15562
15577
|
|
|
15563
15578
|
// src/commands/backlog/unlink.ts
|
|
@@ -17089,27 +17104,27 @@ function registerBacklog(program2) {
|
|
|
17089
17104
|
var KEBAB_CASE_REGEX = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
17090
17105
|
var HASH_REF_REGEX = /#\d+/;
|
|
17091
17106
|
var BACKLOG_NUMBER_SEGMENT_REGEX = /(?:^|-)\d{1,4}(?:-|$)/;
|
|
17092
|
-
function validateSlug(
|
|
17093
|
-
if (!
|
|
17107
|
+
function validateSlug(slug2) {
|
|
17108
|
+
if (!slug2) {
|
|
17094
17109
|
return "Slug is required";
|
|
17095
17110
|
}
|
|
17096
|
-
if (HASH_REF_REGEX.test(
|
|
17097
|
-
return `Slug "${
|
|
17111
|
+
if (HASH_REF_REGEX.test(slug2)) {
|
|
17112
|
+
return `Slug "${slug2}" contains a backlog reference (#<number>); remove it`;
|
|
17098
17113
|
}
|
|
17099
|
-
if (!KEBAB_CASE_REGEX.test(
|
|
17100
|
-
return `Slug "${
|
|
17114
|
+
if (!KEBAB_CASE_REGEX.test(slug2)) {
|
|
17115
|
+
return `Slug "${slug2}" must be kebab-case (lowercase letters, digits, and hyphens)`;
|
|
17101
17116
|
}
|
|
17102
|
-
if (BACKLOG_NUMBER_SEGMENT_REGEX.test(
|
|
17103
|
-
return `Slug "${
|
|
17117
|
+
if (BACKLOG_NUMBER_SEGMENT_REGEX.test(slug2)) {
|
|
17118
|
+
return `Slug "${slug2}" contains a numeric token that looks like a backlog ID; remove or reword it`;
|
|
17104
17119
|
}
|
|
17105
17120
|
return null;
|
|
17106
17121
|
}
|
|
17107
17122
|
|
|
17108
17123
|
// src/commands/branch/branch.ts
|
|
17109
|
-
async function branch(
|
|
17110
|
-
const conciseSlug = isConciseSlug(
|
|
17111
|
-
if (conciseSlug !==
|
|
17112
|
-
console.log(`Shortened "${
|
|
17124
|
+
async function branch(slug2, options2) {
|
|
17125
|
+
const conciseSlug = isConciseSlug(slug2) ? slug2 : await generateBranchSlug(slug2);
|
|
17126
|
+
if (conciseSlug !== slug2) {
|
|
17127
|
+
console.log(`Shortened "${slug2}" to "${conciseSlug}"`);
|
|
17113
17128
|
}
|
|
17114
17129
|
const slugError = validateSlug(conciseSlug);
|
|
17115
17130
|
if (slugError) {
|
|
@@ -17140,7 +17155,7 @@ function registerBranch(program2) {
|
|
|
17140
17155
|
"--from <ref>",
|
|
17141
17156
|
"base the branch off <ref> verbatim (local branch, tag, or origin/*) instead of the fresh remote default"
|
|
17142
17157
|
).action(
|
|
17143
|
-
(
|
|
17158
|
+
(slug2, options2) => branch(slug2, options2)
|
|
17144
17159
|
);
|
|
17145
17160
|
configHelp(
|
|
17146
17161
|
branchCommand,
|
|
@@ -22534,11 +22549,11 @@ function printFixStructurePlan(plan2, chain2, apply) {
|
|
|
22534
22549
|
// src/commands/github/issue/parseRepoSlug.ts
|
|
22535
22550
|
var REPO_SLUG = /^([^/\s]+)\/([^/\s]+)$/;
|
|
22536
22551
|
function parseRepoSlug(repo) {
|
|
22537
|
-
const
|
|
22538
|
-
if (!
|
|
22552
|
+
const slug2 = REPO_SLUG.exec(repo.trim());
|
|
22553
|
+
if (!slug2) {
|
|
22539
22554
|
throw new Error(`--repo must be owner/repo, not "${repo}"`);
|
|
22540
22555
|
}
|
|
22541
|
-
return { owner:
|
|
22556
|
+
return { owner: slug2[1] ?? "", repo: slug2[2] ?? "" };
|
|
22542
22557
|
}
|
|
22543
22558
|
|
|
22544
22559
|
// src/commands/github/issue/fixStructure/resolveFixStructureTarget.ts
|
|
@@ -22546,8 +22561,8 @@ var BARE_NUMBER = /^#?(\d+)$/;
|
|
|
22546
22561
|
function resolveFixStructureTarget(target, repo) {
|
|
22547
22562
|
const shorthand = normalizeGithubIssue(target);
|
|
22548
22563
|
if (shorthand) {
|
|
22549
|
-
const [
|
|
22550
|
-
const [owner, name] = (
|
|
22564
|
+
const [slug2, number] = shorthand.split("#");
|
|
22565
|
+
const [owner, name] = (slug2 ?? "").split("/");
|
|
22551
22566
|
return { owner: owner ?? "", repo: name ?? "", number: Number(number) };
|
|
22552
22567
|
}
|
|
22553
22568
|
const bare = BARE_NUMBER.exec(target.trim());
|
|
@@ -23345,8 +23360,8 @@ import { existsSync as existsSync55, readFileSync as readFileSync39 } from "fs";
|
|
|
23345
23360
|
|
|
23346
23361
|
// src/commands/github/issue/issueWorkingFile.ts
|
|
23347
23362
|
import { join as join59 } from "path";
|
|
23348
|
-
function issueWorkingFile(
|
|
23349
|
-
const [owner = "unknown", repo = "unknown"] =
|
|
23363
|
+
function issueWorkingFile(slug2, number) {
|
|
23364
|
+
const [owner = "unknown", repo = "unknown"] = slug2.split("/");
|
|
23350
23365
|
const dir = join59(getStoreDir(), "github-issues", owner, repo);
|
|
23351
23366
|
return {
|
|
23352
23367
|
dir,
|
|
@@ -23356,8 +23371,8 @@ function issueWorkingFile(slug, number) {
|
|
|
23356
23371
|
}
|
|
23357
23372
|
|
|
23358
23373
|
// src/commands/github/issue/resumeIssueBody.ts
|
|
23359
|
-
function resumeIssueBody(
|
|
23360
|
-
const { bodyPath, metaPath } = issueWorkingFile(
|
|
23374
|
+
function resumeIssueBody(slug2, number, updatedAt) {
|
|
23375
|
+
const { bodyPath, metaPath } = issueWorkingFile(slug2, number);
|
|
23361
23376
|
if (!existsSync55(bodyPath) || !existsSync55(metaPath)) return void 0;
|
|
23362
23377
|
try {
|
|
23363
23378
|
const meta = JSON.parse(readFileSync39(metaPath, "utf8"));
|
|
@@ -23379,8 +23394,8 @@ function validateIssueBody(title, body) {
|
|
|
23379
23394
|
|
|
23380
23395
|
// src/commands/github/issue/writeIssueWorkingFile.ts
|
|
23381
23396
|
import { mkdirSync as mkdirSync16, writeFileSync as writeFileSync31 } from "fs";
|
|
23382
|
-
function writeIssueWorkingFile(
|
|
23383
|
-
const { dir, bodyPath, metaPath } = issueWorkingFile(
|
|
23397
|
+
function writeIssueWorkingFile(slug2, number, target, updatedAt, body) {
|
|
23398
|
+
const { dir, bodyPath, metaPath } = issueWorkingFile(slug2, number);
|
|
23384
23399
|
mkdirSync16(dir, { recursive: true });
|
|
23385
23400
|
writeFileSync31(bodyPath, body);
|
|
23386
23401
|
writeFileSync31(
|
|
@@ -23398,12 +23413,12 @@ function slugFromUrl(url) {
|
|
|
23398
23413
|
}
|
|
23399
23414
|
function prepareIssueEdit(number, repo, fresh) {
|
|
23400
23415
|
const issue = fetchIssue2(number, repo);
|
|
23401
|
-
const
|
|
23402
|
-
const target = `${
|
|
23403
|
-
const resumed = fresh ? void 0 : resumeIssueBody(
|
|
23416
|
+
const slug2 = repo ?? slugFromUrl(issue.url);
|
|
23417
|
+
const target = `${slug2}#${number}`;
|
|
23418
|
+
const resumed = fresh ? void 0 : resumeIssueBody(slug2, number, issue.updatedAt);
|
|
23404
23419
|
const body = resumed ?? issue.body;
|
|
23405
23420
|
validateIssueBody(issue.title, body);
|
|
23406
|
-
const save = (markdown) => writeIssueWorkingFile(
|
|
23421
|
+
const save = (markdown) => writeIssueWorkingFile(slug2, number, target, issue.updatedAt, markdown);
|
|
23407
23422
|
const bodyPath = save(body);
|
|
23408
23423
|
if (resumed !== void 0)
|
|
23409
23424
|
console.log(`Previewing the in-progress markdown from ${bodyPath}`);
|
|
@@ -25796,12 +25811,12 @@ function buildMentionMap(rows, resolve25) {
|
|
|
25796
25811
|
visitObjects(rows, (o) => {
|
|
25797
25812
|
const url = profileActionUrl(o);
|
|
25798
25813
|
if (!url || o.children == null) return;
|
|
25799
|
-
const
|
|
25800
|
-
if (!
|
|
25814
|
+
const slug2 = slugFromProfileUrl(url);
|
|
25815
|
+
if (!slug2 || map.has(slug2)) return;
|
|
25801
25816
|
const sink3 = { text: [], hashtags: [] };
|
|
25802
25817
|
collectRscText(o.children, resolve25, sink3, /* @__PURE__ */ new Set());
|
|
25803
25818
|
const name = sink3.text.join(" ").replace(/\s+/g, " ").trim();
|
|
25804
|
-
map.set(
|
|
25819
|
+
map.set(slug2, name ? { slug: slug2, name, url } : { slug: slug2, url });
|
|
25805
25820
|
});
|
|
25806
25821
|
return map;
|
|
25807
25822
|
}
|
|
@@ -25848,16 +25863,16 @@ function linkifyMentions(text18, mentions) {
|
|
|
25848
25863
|
}
|
|
25849
25864
|
|
|
25850
25865
|
// src/commands/netcap/buildPost.ts
|
|
25851
|
-
var profileUrl = (
|
|
25866
|
+
var profileUrl = (slug2) => `https://www.linkedin.com/in/${slug2}/`;
|
|
25852
25867
|
var joinText = (parts) => parts.join(" ").replace(/\s+/g, " ").replace(/\s+([.,!?])/g, "$1").trim();
|
|
25853
25868
|
function resolveMentions(raw, mentionMap, author) {
|
|
25854
25869
|
const slugs = /* @__PURE__ */ new Set();
|
|
25855
25870
|
for (const url of raw.profileUrls) {
|
|
25856
|
-
const
|
|
25857
|
-
if (
|
|
25871
|
+
const slug2 = slugFromProfileUrl(url);
|
|
25872
|
+
if (slug2 && slug2 !== author) slugs.add(slug2);
|
|
25858
25873
|
}
|
|
25859
25874
|
return [...slugs].map(
|
|
25860
|
-
(
|
|
25875
|
+
(slug2) => mentionMap.get(slug2) ?? { slug: slug2, url: profileUrl(slug2) }
|
|
25861
25876
|
);
|
|
25862
25877
|
}
|
|
25863
25878
|
function resolveAuthor(mentionMap, author) {
|
|
@@ -25986,7 +26001,7 @@ function collectVoyagerAttributes(update3, profiles, authorSlug) {
|
|
|
25986
26001
|
}
|
|
25987
26002
|
|
|
25988
26003
|
// src/commands/netcap/resolveVoyagerAuthor.ts
|
|
25989
|
-
var profileUrl2 = (
|
|
26004
|
+
var profileUrl2 = (slug2) => `https://www.linkedin.com/in/${slug2}/`;
|
|
25990
26005
|
function profileSlug(actor) {
|
|
25991
26006
|
const target = asObject(actor?.navigationContext)?.actionTarget;
|
|
25992
26007
|
if (typeof target !== "string") return void 0;
|
|
@@ -25994,10 +26009,10 @@ function profileSlug(actor) {
|
|
|
25994
26009
|
}
|
|
25995
26010
|
function resolveVoyagerAuthor(update3) {
|
|
25996
26011
|
const actor = asObject(update3.actor);
|
|
25997
|
-
const
|
|
25998
|
-
if (!
|
|
26012
|
+
const slug2 = profileSlug(actor);
|
|
26013
|
+
if (!slug2) return void 0;
|
|
25999
26014
|
const name = asObject(actor?.name)?.text;
|
|
26000
|
-
const mention = { slug, url: profileUrl2(
|
|
26015
|
+
const mention = { slug: slug2, url: profileUrl2(slug2) };
|
|
26001
26016
|
if (typeof name === "string" && name.trim()) mention.name = name.trim();
|
|
26002
26017
|
return mention;
|
|
26003
26018
|
}
|
|
@@ -26037,7 +26052,7 @@ function buildVoyagerPost(update3, profiles) {
|
|
|
26037
26052
|
|
|
26038
26053
|
// src/commands/netcap/voyagerProfileMentions.ts
|
|
26039
26054
|
var PROFILE_TYPE = "com.linkedin.voyager.dash.identity.profile.Profile";
|
|
26040
|
-
var profileUrl3 = (
|
|
26055
|
+
var profileUrl3 = (slug2) => `https://www.linkedin.com/in/${slug2}/`;
|
|
26041
26056
|
function profileName(o) {
|
|
26042
26057
|
return [o.firstName, o.lastName].filter((s) => typeof s === "string" && s.length > 0).join(" ");
|
|
26043
26058
|
}
|
|
@@ -26045,12 +26060,12 @@ function voyagerProfileMentions(included) {
|
|
|
26045
26060
|
const map = /* @__PURE__ */ new Map();
|
|
26046
26061
|
for (const o of included) {
|
|
26047
26062
|
const urn = o.entityUrn;
|
|
26048
|
-
const
|
|
26063
|
+
const slug2 = o.publicIdentifier;
|
|
26049
26064
|
if (o.$type !== PROFILE_TYPE) continue;
|
|
26050
|
-
if (typeof urn !== "string" || typeof
|
|
26065
|
+
if (typeof urn !== "string" || typeof slug2 !== "string") continue;
|
|
26051
26066
|
const name = profileName(o);
|
|
26052
|
-
const url = profileUrl3(
|
|
26053
|
-
map.set(urn, name ? { slug, name, url } : { slug, url });
|
|
26067
|
+
const url = profileUrl3(slug2);
|
|
26068
|
+
map.set(urn, name ? { slug: slug2, name, url } : { slug: slug2, url });
|
|
26054
26069
|
}
|
|
26055
26070
|
return map;
|
|
26056
26071
|
}
|
|
@@ -30380,9 +30395,6 @@ async function checkoutOnlySession(number) {
|
|
|
30380
30395
|
await done2;
|
|
30381
30396
|
}
|
|
30382
30397
|
|
|
30383
|
-
// src/commands/review/highLevel/runHighLevelReview.ts
|
|
30384
|
-
import chalk213 from "chalk";
|
|
30385
|
-
|
|
30386
30398
|
// src/commands/review/fetchPrDiffInfo.ts
|
|
30387
30399
|
import { execSync as execSync58 } from "child_process";
|
|
30388
30400
|
function getCurrentBranch3() {
|
|
@@ -30590,6 +30602,105 @@ function evaluateHighLevelChecks(subject) {
|
|
|
30590
30602
|
});
|
|
30591
30603
|
}
|
|
30592
30604
|
|
|
30605
|
+
// src/commands/review/highLevel/fetchHighLevelPr.ts
|
|
30606
|
+
import { execSync as execSync59 } from "child_process";
|
|
30607
|
+
function fetchHighLevelPr(prNumber, repo) {
|
|
30608
|
+
const raw = execSync59(
|
|
30609
|
+
`gh pr view ${prNumber} --json body,headRefName,headRefOid -R ${repo.org}/${repo.repo}`,
|
|
30610
|
+
{ encoding: "utf8" }
|
|
30611
|
+
);
|
|
30612
|
+
const pr = JSON.parse(raw);
|
|
30613
|
+
return {
|
|
30614
|
+
body: pr.body ?? "",
|
|
30615
|
+
headRef: pr.headRefName,
|
|
30616
|
+
headSha: pr.headRefOid
|
|
30617
|
+
};
|
|
30618
|
+
}
|
|
30619
|
+
|
|
30620
|
+
// src/commands/review/highLevel/openHighLevelOverlay.ts
|
|
30621
|
+
import { randomUUID as randomUUID17 } from "crypto";
|
|
30622
|
+
|
|
30623
|
+
// src/commands/review/highLevel/buildHighLevelRecord.ts
|
|
30624
|
+
function toItem2(check2, decision) {
|
|
30625
|
+
const ticked = decision.checklist?.find((entry) => entry.id === check2.id);
|
|
30626
|
+
const comment3 = ticked?.comment?.trim();
|
|
30627
|
+
return {
|
|
30628
|
+
id: check2.id,
|
|
30629
|
+
kind: check2.kind,
|
|
30630
|
+
title: check2.title,
|
|
30631
|
+
status: check2.status,
|
|
30632
|
+
reason: check2.reason,
|
|
30633
|
+
ticked: ticked?.ticked ?? check2.status === "pass",
|
|
30634
|
+
...comment3 ? { comment: comment3 } : {}
|
|
30635
|
+
};
|
|
30636
|
+
}
|
|
30637
|
+
function buildHighLevelRecord(subject, decision) {
|
|
30638
|
+
const { checks: checks2, ...pr } = subject;
|
|
30639
|
+
return {
|
|
30640
|
+
...pr,
|
|
30641
|
+
verdict: decision.decision === "approve" ? "approve" : "request-changes",
|
|
30642
|
+
reviewedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
30643
|
+
items: checks2.map((check2) => toItem2(check2, decision))
|
|
30644
|
+
};
|
|
30645
|
+
}
|
|
30646
|
+
|
|
30647
|
+
// src/commands/review/highLevel/saveHighLevelReview.ts
|
|
30648
|
+
import { mkdirSync as mkdirSync21, writeFileSync as writeFileSync38 } from "fs";
|
|
30649
|
+
import { dirname as dirname34 } from "path";
|
|
30650
|
+
|
|
30651
|
+
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
30652
|
+
import { join as join75 } from "path";
|
|
30653
|
+
function slug(value) {
|
|
30654
|
+
return value.replace(/[^\w.-]+/g, "-");
|
|
30655
|
+
}
|
|
30656
|
+
function highLevelReviewPath(repo, headRef, headSha) {
|
|
30657
|
+
return join75(
|
|
30658
|
+
getStoreDir(),
|
|
30659
|
+
"high-level-reviews",
|
|
30660
|
+
slug(repo),
|
|
30661
|
+
`${slug(headRef)}-${headSha}.json`
|
|
30662
|
+
);
|
|
30663
|
+
}
|
|
30664
|
+
|
|
30665
|
+
// src/commands/review/highLevel/saveHighLevelReview.ts
|
|
30666
|
+
function saveHighLevelReview(record) {
|
|
30667
|
+
const path91 = highLevelReviewPath(record.repo, record.headRef, record.headSha);
|
|
30668
|
+
mkdirSync21(dirname34(path91), { recursive: true });
|
|
30669
|
+
writeFileSync38(path91, `${JSON.stringify(record, null, 2)}
|
|
30670
|
+
`);
|
|
30671
|
+
return path91;
|
|
30672
|
+
}
|
|
30673
|
+
|
|
30674
|
+
// src/commands/review/highLevel/openHighLevelOverlay.ts
|
|
30675
|
+
async function openHighLevelOverlay(sessionId, subject) {
|
|
30676
|
+
const decision = await awaitPreviewApproval(
|
|
30677
|
+
"High-level review",
|
|
30678
|
+
{
|
|
30679
|
+
sessionId,
|
|
30680
|
+
requestId: randomUUID17(),
|
|
30681
|
+
title: `High-level review of ${subject.repo}#${subject.prNumber}`,
|
|
30682
|
+
body: JSON.stringify(subject.checks),
|
|
30683
|
+
prNumber: subject.prNumber,
|
|
30684
|
+
kind: "high-level-review",
|
|
30685
|
+
metadata: [
|
|
30686
|
+
{ label: "Branch", value: subject.headRef },
|
|
30687
|
+
{ label: "Head", value: subject.headSha.slice(0, 7) },
|
|
30688
|
+
{ label: "Changed files", value: String(subject.changedFileCount) }
|
|
30689
|
+
]
|
|
30690
|
+
},
|
|
30691
|
+
{ rejectIsOutcome: true }
|
|
30692
|
+
);
|
|
30693
|
+
const record = buildHighLevelRecord(subject, decision);
|
|
30694
|
+
const path91 = saveHighLevelReview(record);
|
|
30695
|
+
console.log(`Verdict: ${record.verdict}`);
|
|
30696
|
+
console.log(`Saved ${path91}`);
|
|
30697
|
+
console.log("Nothing was posted to GitHub.");
|
|
30698
|
+
return record;
|
|
30699
|
+
}
|
|
30700
|
+
|
|
30701
|
+
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
30702
|
+
import chalk213 from "chalk";
|
|
30703
|
+
|
|
30593
30704
|
// src/commands/review/highLevel/formatHighLevelChecklist.ts
|
|
30594
30705
|
import chalk212 from "chalk";
|
|
30595
30706
|
var MARKERS = {
|
|
@@ -30627,6 +30738,25 @@ function formatHighLevelChecklist(checks2) {
|
|
|
30627
30738
|
].join("\n");
|
|
30628
30739
|
}
|
|
30629
30740
|
|
|
30741
|
+
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
30742
|
+
function printHighLevelChecklist(subject) {
|
|
30743
|
+
console.log(
|
|
30744
|
+
chalk213.bold(`High-level review of ${subject.repo}#${subject.prNumber}`),
|
|
30745
|
+
chalk213.dim(`\xB7 ${subject.changedFileCount} changed files`)
|
|
30746
|
+
);
|
|
30747
|
+
console.log(formatHighLevelChecklist(subject.checks));
|
|
30748
|
+
console.log(
|
|
30749
|
+
chalk213.dim(
|
|
30750
|
+
"\nManual items are for the reviewer to judge; see docs/high-level-review.md."
|
|
30751
|
+
)
|
|
30752
|
+
);
|
|
30753
|
+
console.log(
|
|
30754
|
+
chalk213.dim(
|
|
30755
|
+
"Run this inside an assist session to step through the checklist in the web overlay."
|
|
30756
|
+
)
|
|
30757
|
+
);
|
|
30758
|
+
}
|
|
30759
|
+
|
|
30630
30760
|
// src/commands/review/highLevel/resolveHighLevelConfig.ts
|
|
30631
30761
|
var DEFAULT_DESCRIPTION_WORD_CAP = 300;
|
|
30632
30762
|
function resolveHighLevelConfig(config) {
|
|
@@ -30648,23 +30778,30 @@ function resolvePrNumber2(number) {
|
|
|
30648
30778
|
}
|
|
30649
30779
|
return parsed;
|
|
30650
30780
|
}
|
|
30651
|
-
function
|
|
30781
|
+
function gather(number) {
|
|
30652
30782
|
const prNumber = resolvePrNumber2(number);
|
|
30653
30783
|
const { org, repo } = getRepoInfo();
|
|
30654
|
-
const
|
|
30655
|
-
const body = fetchPrBody(prNumber, { org, repo });
|
|
30784
|
+
const pr = fetchHighLevelPr(prNumber, { org, repo });
|
|
30656
30785
|
const changedFiles2 = fetchPrChangedFiles(prNumber);
|
|
30657
|
-
|
|
30658
|
-
|
|
30659
|
-
|
|
30660
|
-
|
|
30661
|
-
|
|
30662
|
-
|
|
30663
|
-
|
|
30664
|
-
|
|
30665
|
-
|
|
30666
|
-
|
|
30667
|
-
|
|
30786
|
+
return {
|
|
30787
|
+
repo: `${org}/${repo}`,
|
|
30788
|
+
prNumber,
|
|
30789
|
+
headRef: pr.headRef,
|
|
30790
|
+
headSha: pr.headSha,
|
|
30791
|
+
changedFileCount: changedFiles2.length,
|
|
30792
|
+
checks: evaluateHighLevelChecks({
|
|
30793
|
+
body: pr.body,
|
|
30794
|
+
changedFiles: changedFiles2,
|
|
30795
|
+
config: resolveHighLevelConfig(loadConfig())
|
|
30796
|
+
})
|
|
30797
|
+
};
|
|
30798
|
+
}
|
|
30799
|
+
async function runHighLevelReview(number) {
|
|
30800
|
+
const subject = gather(number);
|
|
30801
|
+
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
30802
|
+
if (process.env.ASSIST_SESSION !== "1" || !sessionId)
|
|
30803
|
+
return printHighLevelChecklist(subject);
|
|
30804
|
+
await openHighLevelOverlay(sessionId, subject);
|
|
30668
30805
|
}
|
|
30669
30806
|
|
|
30670
30807
|
// src/commands/review/annotateDiffWithLineNumbers.ts
|
|
@@ -30781,9 +30918,9 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
30781
30918
|
|
|
30782
30919
|
// src/commands/review/buildReviewPaths.ts
|
|
30783
30920
|
import { homedir as homedir23 } from "os";
|
|
30784
|
-
import { basename as basename20, join as
|
|
30921
|
+
import { basename as basename20, join as join76 } from "path";
|
|
30785
30922
|
function buildReviewPaths(repoRoot2, key) {
|
|
30786
|
-
const reviewDir =
|
|
30923
|
+
const reviewDir = join76(
|
|
30787
30924
|
homedir23(),
|
|
30788
30925
|
".assist",
|
|
30789
30926
|
"reviews",
|
|
@@ -30792,17 +30929,17 @@ function buildReviewPaths(repoRoot2, key) {
|
|
|
30792
30929
|
);
|
|
30793
30930
|
return {
|
|
30794
30931
|
reviewDir,
|
|
30795
|
-
requestPath:
|
|
30796
|
-
claudePath:
|
|
30797
|
-
codexPath:
|
|
30798
|
-
synthesisPath:
|
|
30932
|
+
requestPath: join76(reviewDir, "request.md"),
|
|
30933
|
+
claudePath: join76(reviewDir, "claude.md"),
|
|
30934
|
+
codexPath: join76(reviewDir, "codex.md"),
|
|
30935
|
+
synthesisPath: join76(reviewDir, "synthesis.md")
|
|
30799
30936
|
};
|
|
30800
30937
|
}
|
|
30801
30938
|
|
|
30802
30939
|
// src/commands/review/fetchExistingComments.ts
|
|
30803
|
-
import { execSync as
|
|
30940
|
+
import { execSync as execSync60 } from "child_process";
|
|
30804
30941
|
function fetchRawComments(org, repo, prNumber) {
|
|
30805
|
-
const out =
|
|
30942
|
+
const out = execSync60(
|
|
30806
30943
|
`gh api --paginate repos/${org}/${repo}/pulls/${prNumber}/comments`,
|
|
30807
30944
|
{ encoding: "utf8", maxBuffer: 64 * 1024 * 1024 }
|
|
30808
30945
|
);
|
|
@@ -30833,14 +30970,14 @@ function fetchExistingComments() {
|
|
|
30833
30970
|
}
|
|
30834
30971
|
|
|
30835
30972
|
// src/commands/review/gatherContext.ts
|
|
30836
|
-
import { execSync as
|
|
30973
|
+
import { execSync as execSync62 } from "child_process";
|
|
30837
30974
|
|
|
30838
30975
|
// src/commands/review/fetchPrDiff.ts
|
|
30839
|
-
import { execSync as
|
|
30976
|
+
import { execSync as execSync61 } from "child_process";
|
|
30840
30977
|
function fetchPrDiff(prNumber, baseSha, headSha) {
|
|
30841
30978
|
const { org, repo } = getRepoInfo();
|
|
30842
30979
|
try {
|
|
30843
|
-
return
|
|
30980
|
+
return execSync61(`gh pr diff ${prNumber} -R ${org}/${repo}`, {
|
|
30844
30981
|
encoding: "utf8",
|
|
30845
30982
|
maxBuffer: 256 * 1024 * 1024,
|
|
30846
30983
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -30855,10 +30992,10 @@ function isDiffTooLarge(error) {
|
|
|
30855
30992
|
}
|
|
30856
30993
|
function fetchDiffViaGit(baseSha, headSha) {
|
|
30857
30994
|
try {
|
|
30858
|
-
|
|
30995
|
+
execSync61(`git fetch origin ${baseSha} ${headSha}`, { stdio: "ignore" });
|
|
30859
30996
|
} catch {
|
|
30860
30997
|
}
|
|
30861
|
-
return
|
|
30998
|
+
return execSync61(`git diff ${baseSha}...${headSha}`, {
|
|
30862
30999
|
encoding: "utf8",
|
|
30863
31000
|
maxBuffer: 256 * 1024 * 1024
|
|
30864
31001
|
});
|
|
@@ -30866,11 +31003,11 @@ function fetchDiffViaGit(baseSha, headSha) {
|
|
|
30866
31003
|
|
|
30867
31004
|
// src/commands/review/gatherContext.ts
|
|
30868
31005
|
function gatherContext() {
|
|
30869
|
-
const branch2 =
|
|
31006
|
+
const branch2 = execSync62("git rev-parse --abbrev-ref HEAD", {
|
|
30870
31007
|
encoding: "utf8"
|
|
30871
31008
|
}).trim();
|
|
30872
|
-
const sha =
|
|
30873
|
-
const shortSha =
|
|
31009
|
+
const sha = execSync62("git rev-parse HEAD", { encoding: "utf8" }).trim();
|
|
31010
|
+
const shortSha = execSync62("git rev-parse --short=7 HEAD", {
|
|
30874
31011
|
encoding: "utf8"
|
|
30875
31012
|
}).trim();
|
|
30876
31013
|
const prInfo = fetchPrDiffInfo();
|
|
@@ -31478,16 +31615,16 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
|
|
|
31478
31615
|
}
|
|
31479
31616
|
|
|
31480
31617
|
// src/commands/review/prepareReviewDir.ts
|
|
31481
|
-
import { existsSync as existsSync63, mkdirSync as
|
|
31618
|
+
import { existsSync as existsSync63, mkdirSync as mkdirSync22, unlinkSync as unlinkSync17, writeFileSync as writeFileSync39 } from "fs";
|
|
31482
31619
|
function clearReviewFiles(paths) {
|
|
31483
31620
|
for (const path91 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
31484
31621
|
if (existsSync63(path91)) unlinkSync17(path91);
|
|
31485
31622
|
}
|
|
31486
31623
|
}
|
|
31487
31624
|
function prepareReviewDir(paths, requestBody, force) {
|
|
31488
|
-
|
|
31625
|
+
mkdirSync22(paths.reviewDir, { recursive: true });
|
|
31489
31626
|
if (force) clearReviewFiles(paths);
|
|
31490
|
-
|
|
31627
|
+
writeFileSync39(paths.requestPath, requestBody);
|
|
31491
31628
|
}
|
|
31492
31629
|
|
|
31493
31630
|
// src/commands/review/cachedReviewerResult.ts
|
|
@@ -31542,8 +31679,8 @@ function renderEntry(entry, frame) {
|
|
|
31542
31679
|
import { format } from "util";
|
|
31543
31680
|
|
|
31544
31681
|
// src/commands/review/createReviewLogSink.ts
|
|
31545
|
-
import { appendFileSync as appendFileSync2, mkdirSync as
|
|
31546
|
-
import { join as
|
|
31682
|
+
import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync23 } from "fs";
|
|
31683
|
+
import { join as join77 } from "path";
|
|
31547
31684
|
|
|
31548
31685
|
// src/shared/stripAnsi.ts
|
|
31549
31686
|
var ANSI = new RegExp(
|
|
@@ -31570,8 +31707,8 @@ function createReviewLogSink() {
|
|
|
31570
31707
|
`);
|
|
31571
31708
|
},
|
|
31572
31709
|
attach(reviewDir) {
|
|
31573
|
-
|
|
31574
|
-
logPath2 =
|
|
31710
|
+
mkdirSync23(reviewDir, { recursive: true });
|
|
31711
|
+
logPath2 = join77(reviewDir, LOG_FILE);
|
|
31575
31712
|
const lines2 = [
|
|
31576
31713
|
"",
|
|
31577
31714
|
`=== ${(/* @__PURE__ */ new Date()).toISOString()} ===`,
|
|
@@ -31860,7 +31997,7 @@ The review request is at: ${requestPath}
|
|
|
31860
31997
|
}
|
|
31861
31998
|
|
|
31862
31999
|
// src/commands/review/runClaudeReviewer.ts
|
|
31863
|
-
import { writeFileSync as
|
|
32000
|
+
import { writeFileSync as writeFileSync40 } from "fs";
|
|
31864
32001
|
|
|
31865
32002
|
// src/commands/review/finaliseReviewerSpinner.ts
|
|
31866
32003
|
var SUMMARY_MAX_LEN = 80;
|
|
@@ -32207,7 +32344,7 @@ async function runClaudeReviewer(spec) {
|
|
|
32207
32344
|
}
|
|
32208
32345
|
});
|
|
32209
32346
|
if (result.exitCode === 0 && finalText)
|
|
32210
|
-
|
|
32347
|
+
writeFileSync40(spec.outputPath, finalText);
|
|
32211
32348
|
return finaliseReviewerRun({ ...spec, command }, spinner, result);
|
|
32212
32349
|
}
|
|
32213
32350
|
|
|
@@ -32627,9 +32764,10 @@ async function review(options2 = {}) {
|
|
|
32627
32764
|
if (options2.checkoutOnly && options2.number)
|
|
32628
32765
|
return checkoutOnlySession(options2.number);
|
|
32629
32766
|
emitActivity({ kind: "command", name: "review" });
|
|
32630
|
-
if (options2.
|
|
32631
|
-
|
|
32767
|
+
if (!options2.number)
|
|
32768
|
+
return options2.highLevel ? runHighLevelReview(void 0) : reviewPr(invokedIn, options2);
|
|
32632
32769
|
await checkoutPr(options2.number);
|
|
32770
|
+
if (options2.highLevel) return runHighLevelReview(options2.number);
|
|
32633
32771
|
return reviewPr(resolveRepoRoot(), options2);
|
|
32634
32772
|
}
|
|
32635
32773
|
|
|
@@ -32663,7 +32801,7 @@ function registerReview(program2) {
|
|
|
32663
32801
|
"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
32802
|
).option(
|
|
32665
32803
|
"--high-level",
|
|
32666
|
-
"Skip the LLM review;
|
|
32804
|
+
"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
32805
|
).option(
|
|
32668
32806
|
"--address-comments",
|
|
32669
32807
|
"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 +32822,7 @@ function registerReview(program2) {
|
|
|
32684
32822
|
}
|
|
32685
32823
|
|
|
32686
32824
|
// src/commands/rules/addRule.ts
|
|
32687
|
-
import { existsSync as existsSync68, readFileSync as readFileSync52, writeFileSync as
|
|
32825
|
+
import { existsSync as existsSync68, readFileSync as readFileSync52, writeFileSync as writeFileSync42 } from "fs";
|
|
32688
32826
|
import path72 from "path";
|
|
32689
32827
|
import chalk216 from "chalk";
|
|
32690
32828
|
|
|
@@ -32759,7 +32897,7 @@ function resolveRuleScope(target) {
|
|
|
32759
32897
|
}
|
|
32760
32898
|
|
|
32761
32899
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
32762
|
-
import { existsSync as existsSync67, readFileSync as readFileSync51, writeFileSync as
|
|
32900
|
+
import { existsSync as existsSync67, readFileSync as readFileSync51, writeFileSync as writeFileSync41 } from "fs";
|
|
32763
32901
|
import path71 from "path";
|
|
32764
32902
|
|
|
32765
32903
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
@@ -32811,7 +32949,7 @@ function updateScopedRulesIndex(root) {
|
|
|
32811
32949
|
const rootFile = path71.join(root, "CLAUDE.md");
|
|
32812
32950
|
const before = existsSync67(rootFile) ? readFileSync51(rootFile, "utf8") : "";
|
|
32813
32951
|
const after = upsertScopedRulesPointer(before, directories);
|
|
32814
|
-
if (after !== before)
|
|
32952
|
+
if (after !== before) writeFileSync41(rootFile, after);
|
|
32815
32953
|
return directories;
|
|
32816
32954
|
}
|
|
32817
32955
|
|
|
@@ -32830,7 +32968,7 @@ function addRule(text18, options2) {
|
|
|
32830
32968
|
const targetDir = path72.dirname(target);
|
|
32831
32969
|
const root = findRepoRoot(targetDir) ?? targetDir;
|
|
32832
32970
|
const code = nextRuleCode(root);
|
|
32833
|
-
|
|
32971
|
+
writeFileSync42(
|
|
32834
32972
|
target,
|
|
32835
32973
|
insertRuleBullet(read2(target), {
|
|
32836
32974
|
code,
|
|
@@ -33275,10 +33413,10 @@ function parseSlackThreadRef(value) {
|
|
|
33275
33413
|
}
|
|
33276
33414
|
|
|
33277
33415
|
// src/commands/slack/postSlackMessage.ts
|
|
33278
|
-
import { mkdirSync as
|
|
33416
|
+
import { mkdirSync as mkdirSync24, writeFileSync as writeFileSync43 } from "fs";
|
|
33279
33417
|
|
|
33280
33418
|
// src/commands/slack/reviewProposedSlackMessage.ts
|
|
33281
|
-
import { randomUUID as
|
|
33419
|
+
import { randomUUID as randomUUID18 } from "crypto";
|
|
33282
33420
|
async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
33283
33421
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
33284
33422
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
|
|
@@ -33287,7 +33425,7 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
33287
33425
|
"Slack message preview",
|
|
33288
33426
|
{
|
|
33289
33427
|
sessionId,
|
|
33290
|
-
requestId:
|
|
33428
|
+
requestId: randomUUID18(),
|
|
33291
33429
|
title: threadTs ? `Reply in ${channel} thread ${threadTs}` : `Post to ${channel}`,
|
|
33292
33430
|
body,
|
|
33293
33431
|
prNumber: null,
|
|
@@ -33300,11 +33438,11 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
33300
33438
|
}
|
|
33301
33439
|
|
|
33302
33440
|
// src/commands/slack/slackWorkingFile.ts
|
|
33303
|
-
import { join as
|
|
33441
|
+
import { join as join78 } from "path";
|
|
33304
33442
|
function slackWorkingFile(channel) {
|
|
33305
|
-
const
|
|
33306
|
-
const dir =
|
|
33307
|
-
return { dir, bodyPath:
|
|
33443
|
+
const slug2 = channel.replace(/^[#@]/, "").toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "channel";
|
|
33444
|
+
const dir = join78(getStoreDir(), "slack");
|
|
33445
|
+
return { dir, bodyPath: join78(dir, `${slug2}.md`) };
|
|
33308
33446
|
}
|
|
33309
33447
|
|
|
33310
33448
|
// src/commands/slack/postSlackMessage.ts
|
|
@@ -33325,8 +33463,8 @@ async function postSlackMessage(channelArg, options2) {
|
|
|
33325
33463
|
}
|
|
33326
33464
|
const threadTs = options2.thread;
|
|
33327
33465
|
const { dir, bodyPath } = slackWorkingFile(channel);
|
|
33328
|
-
|
|
33329
|
-
|
|
33466
|
+
mkdirSync24(dir, { recursive: true });
|
|
33467
|
+
writeFileSync43(bodyPath, `${body}
|
|
33330
33468
|
`);
|
|
33331
33469
|
await reviewProposedSlackMessage({ channel, threadTs }, body, bodyPath);
|
|
33332
33470
|
const target = threadTs ? `${channel} (thread_ts ${threadTs})` : channel;
|
|
@@ -34402,20 +34540,20 @@ async function configure() {
|
|
|
34402
34540
|
|
|
34403
34541
|
// src/commands/transcript/list.ts
|
|
34404
34542
|
import { existsSync as existsSync74, readdirSync as readdirSync21, statSync as statSync11 } from "fs";
|
|
34405
|
-
import { join as
|
|
34543
|
+
import { join as join89 } from "path";
|
|
34406
34544
|
function list4() {
|
|
34407
34545
|
const { vttDir } = getTranscriptConfig();
|
|
34408
34546
|
if (!existsSync74(vttDir)) return;
|
|
34409
34547
|
for (const entry of readdirSync21(vttDir)) {
|
|
34410
34548
|
if (!entry.endsWith(".vtt")) continue;
|
|
34411
|
-
if (statSync11(
|
|
34549
|
+
if (statSync11(join89(vttDir, entry)).isDirectory()) continue;
|
|
34412
34550
|
console.log(entry);
|
|
34413
34551
|
}
|
|
34414
34552
|
}
|
|
34415
34553
|
|
|
34416
34554
|
// src/commands/transcript/move.ts
|
|
34417
|
-
import { existsSync as existsSync75, mkdirSync as
|
|
34418
|
-
import { basename as basename23, join as
|
|
34555
|
+
import { existsSync as existsSync75, mkdirSync as mkdirSync30, renameSync as renameSync2, writeFileSync as writeFileSync47 } from "fs";
|
|
34556
|
+
import { basename as basename23, join as join90 } from "path";
|
|
34419
34557
|
|
|
34420
34558
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
34421
34559
|
function convertVttToMarkdown(inputPath) {
|
|
@@ -34425,9 +34563,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
34425
34563
|
// src/commands/transcript/move.ts
|
|
34426
34564
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
34427
34565
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
34428
|
-
const processedDir =
|
|
34429
|
-
|
|
34430
|
-
renameSync2(sourcePath,
|
|
34566
|
+
const processedDir = join90(vttDir, "processed");
|
|
34567
|
+
mkdirSync30(processedDir, { recursive: true });
|
|
34568
|
+
renameSync2(sourcePath, join90(processedDir, filename));
|
|
34431
34569
|
}
|
|
34432
34570
|
function move(file, options2) {
|
|
34433
34571
|
const { date, client } = options2;
|
|
@@ -34437,25 +34575,25 @@ function move(file, options2) {
|
|
|
34437
34575
|
}
|
|
34438
34576
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
34439
34577
|
const filename = basename23(file);
|
|
34440
|
-
const sourcePath =
|
|
34578
|
+
const sourcePath = join90(vttDir, filename);
|
|
34441
34579
|
if (!existsSync75(sourcePath)) {
|
|
34442
34580
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
34443
34581
|
process.exit(1);
|
|
34444
34582
|
}
|
|
34445
34583
|
const base = basename23(filename, ".vtt").replace(/ Transcription$/, "");
|
|
34446
34584
|
const outputName = `${date} ${base}.md`;
|
|
34447
|
-
const formattedDir =
|
|
34448
|
-
|
|
34449
|
-
const formattedPath =
|
|
34450
|
-
|
|
34585
|
+
const formattedDir = join90(transcriptsDir, client);
|
|
34586
|
+
mkdirSync30(formattedDir, { recursive: true });
|
|
34587
|
+
const formattedPath = join90(formattedDir, outputName);
|
|
34588
|
+
writeFileSync47(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
34451
34589
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
34452
|
-
const summaryPath =
|
|
34590
|
+
const summaryPath = join90(summaryDir, client, outputName);
|
|
34453
34591
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
34454
34592
|
console.log(`Summary target: ${summaryPath}`);
|
|
34455
34593
|
}
|
|
34456
34594
|
|
|
34457
34595
|
// src/commands/transcript/merge.ts
|
|
34458
|
-
import { existsSync as existsSync76, writeFileSync as
|
|
34596
|
+
import { existsSync as existsSync76, writeFileSync as writeFileSync48 } from "fs";
|
|
34459
34597
|
import { basename as basename24 } from "path";
|
|
34460
34598
|
|
|
34461
34599
|
// src/commands/transcript/failTranscript.ts
|
|
@@ -34632,7 +34770,7 @@ async function merge(files, options2 = {}) {
|
|
|
34632
34770
|
console.log(document);
|
|
34633
34771
|
return;
|
|
34634
34772
|
}
|
|
34635
|
-
|
|
34773
|
+
writeFileSync48(options2.out, `${document}
|
|
34636
34774
|
`, "utf8");
|
|
34637
34775
|
console.log(`Merged transcript: ${options2.out}`);
|
|
34638
34776
|
}
|
|
@@ -34768,38 +34906,38 @@ function registerVerify(program2) {
|
|
|
34768
34906
|
|
|
34769
34907
|
// src/commands/voice/devices.ts
|
|
34770
34908
|
import { spawnSync as spawnSync9 } from "child_process";
|
|
34771
|
-
import { join as
|
|
34909
|
+
import { join as join92 } from "path";
|
|
34772
34910
|
|
|
34773
34911
|
// src/commands/voice/shared.ts
|
|
34774
34912
|
import { homedir as homedir25 } from "os";
|
|
34775
|
-
import { dirname as
|
|
34913
|
+
import { dirname as dirname38, join as join91 } from "path";
|
|
34776
34914
|
import { fileURLToPath as fileURLToPath10 } from "url";
|
|
34777
|
-
var __dirname6 =
|
|
34778
|
-
var VOICE_DIR =
|
|
34915
|
+
var __dirname6 = dirname38(fileURLToPath10(import.meta.url));
|
|
34916
|
+
var VOICE_DIR = join91(homedir25(), ".assist", "voice");
|
|
34779
34917
|
var voicePaths = {
|
|
34780
34918
|
dir: VOICE_DIR,
|
|
34781
|
-
pid:
|
|
34782
|
-
log:
|
|
34783
|
-
venv:
|
|
34784
|
-
lock:
|
|
34919
|
+
pid: join91(VOICE_DIR, "voice.pid"),
|
|
34920
|
+
log: join91(VOICE_DIR, "voice.log"),
|
|
34921
|
+
venv: join91(VOICE_DIR, ".venv"),
|
|
34922
|
+
lock: join91(VOICE_DIR, "voice.lock")
|
|
34785
34923
|
};
|
|
34786
34924
|
function getPythonDir() {
|
|
34787
|
-
return
|
|
34925
|
+
return join91(__dirname6, "commands", "voice", "python");
|
|
34788
34926
|
}
|
|
34789
34927
|
function getVenvPython() {
|
|
34790
|
-
return process.platform === "win32" ?
|
|
34928
|
+
return process.platform === "win32" ? join91(voicePaths.venv, "Scripts", "python.exe") : join91(voicePaths.venv, "bin", "python");
|
|
34791
34929
|
}
|
|
34792
34930
|
function getLockDir() {
|
|
34793
34931
|
const config = loadConfig();
|
|
34794
34932
|
return config.voice?.lockDir ?? VOICE_DIR;
|
|
34795
34933
|
}
|
|
34796
34934
|
function getLockFile() {
|
|
34797
|
-
return
|
|
34935
|
+
return join91(getLockDir(), "voice.lock");
|
|
34798
34936
|
}
|
|
34799
34937
|
|
|
34800
34938
|
// src/commands/voice/devices.ts
|
|
34801
34939
|
function devices() {
|
|
34802
|
-
const script =
|
|
34940
|
+
const script = join92(getPythonDir(), "list_devices.py");
|
|
34803
34941
|
spawnSync9(getVenvPython(), [script], { stdio: "inherit" });
|
|
34804
34942
|
}
|
|
34805
34943
|
|
|
@@ -34833,13 +34971,13 @@ function logs(options2) {
|
|
|
34833
34971
|
|
|
34834
34972
|
// src/commands/voice/setup.ts
|
|
34835
34973
|
import { spawnSync as spawnSync10 } from "child_process";
|
|
34836
|
-
import { mkdirSync as
|
|
34837
|
-
import { join as
|
|
34974
|
+
import { mkdirSync as mkdirSync32 } from "fs";
|
|
34975
|
+
import { join as join94 } from "path";
|
|
34838
34976
|
|
|
34839
34977
|
// src/commands/voice/checkLockFile.ts
|
|
34840
|
-
import { execSync as
|
|
34841
|
-
import { existsSync as existsSync78, mkdirSync as
|
|
34842
|
-
import { join as
|
|
34978
|
+
import { execSync as execSync63 } from "child_process";
|
|
34979
|
+
import { existsSync as existsSync78, mkdirSync as mkdirSync31, readFileSync as readFileSync58, writeFileSync as writeFileSync49 } from "fs";
|
|
34980
|
+
import { join as join93 } from "path";
|
|
34843
34981
|
function isProcessAlive2(pid) {
|
|
34844
34982
|
try {
|
|
34845
34983
|
process.kill(pid, 0);
|
|
@@ -34866,7 +35004,7 @@ function bootstrapVenv() {
|
|
|
34866
35004
|
if (existsSync78(getVenvPython())) return;
|
|
34867
35005
|
console.log("Setting up Python environment...");
|
|
34868
35006
|
const pythonDir = getPythonDir();
|
|
34869
|
-
|
|
35007
|
+
execSync63(
|
|
34870
35008
|
`uv sync --project "${pythonDir}" --extra runtime --no-install-project`,
|
|
34871
35009
|
{
|
|
34872
35010
|
stdio: "inherit",
|
|
@@ -34876,8 +35014,8 @@ function bootstrapVenv() {
|
|
|
34876
35014
|
}
|
|
34877
35015
|
function writeLockFile(pid) {
|
|
34878
35016
|
const lockFile = getLockFile();
|
|
34879
|
-
|
|
34880
|
-
|
|
35017
|
+
mkdirSync31(join93(lockFile, ".."), { recursive: true });
|
|
35018
|
+
writeFileSync49(
|
|
34881
35019
|
lockFile,
|
|
34882
35020
|
JSON.stringify({
|
|
34883
35021
|
pid,
|
|
@@ -34889,10 +35027,10 @@ function writeLockFile(pid) {
|
|
|
34889
35027
|
|
|
34890
35028
|
// src/commands/voice/setup.ts
|
|
34891
35029
|
function setup() {
|
|
34892
|
-
|
|
35030
|
+
mkdirSync32(voicePaths.dir, { recursive: true });
|
|
34893
35031
|
bootstrapVenv();
|
|
34894
35032
|
console.log("\nDownloading models...\n");
|
|
34895
|
-
const script =
|
|
35033
|
+
const script = join94(getPythonDir(), "setup_models.py");
|
|
34896
35034
|
const result = spawnSync10(getVenvPython(), [script], {
|
|
34897
35035
|
stdio: "inherit",
|
|
34898
35036
|
env: { ...process.env, VOICE_LOG_FILE: voicePaths.log }
|
|
@@ -34905,8 +35043,8 @@ function setup() {
|
|
|
34905
35043
|
|
|
34906
35044
|
// src/commands/voice/start.ts
|
|
34907
35045
|
import { spawn as spawn8 } from "child_process";
|
|
34908
|
-
import { mkdirSync as
|
|
34909
|
-
import { join as
|
|
35046
|
+
import { mkdirSync as mkdirSync33, writeFileSync as writeFileSync50 } from "fs";
|
|
35047
|
+
import { join as join95 } from "path";
|
|
34910
35048
|
|
|
34911
35049
|
// src/commands/voice/buildDaemonEnv.ts
|
|
34912
35050
|
function buildDaemonEnv(options2) {
|
|
@@ -34934,17 +35072,17 @@ function spawnBackground(python, script, env) {
|
|
|
34934
35072
|
console.error("Failed to start voice daemon");
|
|
34935
35073
|
process.exit(1);
|
|
34936
35074
|
}
|
|
34937
|
-
|
|
35075
|
+
writeFileSync50(voicePaths.pid, String(pid));
|
|
34938
35076
|
writeLockFile(pid);
|
|
34939
35077
|
console.log(`Voice daemon started (PID ${pid})`);
|
|
34940
35078
|
}
|
|
34941
35079
|
function start2(options2) {
|
|
34942
|
-
|
|
35080
|
+
mkdirSync33(voicePaths.dir, { recursive: true });
|
|
34943
35081
|
checkLockFile();
|
|
34944
35082
|
bootstrapVenv();
|
|
34945
35083
|
const debug = options2.debug || options2.foreground || process.platform === "win32";
|
|
34946
35084
|
const env = buildDaemonEnv({ debug });
|
|
34947
|
-
const script =
|
|
35085
|
+
const script = join95(getPythonDir(), "voice_daemon.py");
|
|
34948
35086
|
const python = getVenvPython();
|
|
34949
35087
|
if (options2.foreground) {
|
|
34950
35088
|
spawnForeground(python, script, env);
|
|
@@ -35075,11 +35213,11 @@ function changedPaths(from, cwd) {
|
|
|
35075
35213
|
}
|
|
35076
35214
|
|
|
35077
35215
|
// src/commands/watch/readBuiltVersion.ts
|
|
35078
|
-
import { join as
|
|
35216
|
+
import { join as join96 } from "path";
|
|
35079
35217
|
function readBuiltVersion(cwd) {
|
|
35080
35218
|
try {
|
|
35081
35219
|
const root = runGit3(["rev-parse", "--show-toplevel"], cwd);
|
|
35082
|
-
return readPackageJson(
|
|
35220
|
+
return readPackageJson(join96(root, "package.json")).version ?? "unknown";
|
|
35083
35221
|
} catch {
|
|
35084
35222
|
return "unknown";
|
|
35085
35223
|
}
|
|
@@ -35436,13 +35574,13 @@ import { existsSync as existsSync83 } from "fs";
|
|
|
35436
35574
|
// src/commands/run/resolveCommand.ts
|
|
35437
35575
|
import { execFileSync as execFileSync18 } from "child_process";
|
|
35438
35576
|
import { existsSync as existsSync82 } from "fs";
|
|
35439
|
-
import { dirname as
|
|
35577
|
+
import { dirname as dirname39, join as join97, resolve as resolve20 } from "path";
|
|
35440
35578
|
function resolveCommand2(command) {
|
|
35441
35579
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
35442
35580
|
try {
|
|
35443
35581
|
const gitPath = execFileSync18("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
35444
|
-
const gitRoot = resolve20(
|
|
35445
|
-
const gitBash =
|
|
35582
|
+
const gitRoot = resolve20(dirname39(gitPath), "..");
|
|
35583
|
+
const gitBash = join97(gitRoot, "bin", "bash.exe");
|
|
35446
35584
|
if (existsSync82(gitBash)) return gitBash;
|
|
35447
35585
|
} catch {
|
|
35448
35586
|
return command;
|
|
@@ -35487,11 +35625,11 @@ function runCommandToCompletion(command, args, env, cwd, quiet) {
|
|
|
35487
35625
|
}
|
|
35488
35626
|
|
|
35489
35627
|
// src/commands/run/runPreCommands.ts
|
|
35490
|
-
import { execSync as
|
|
35628
|
+
import { execSync as execSync64 } from "child_process";
|
|
35491
35629
|
function runPreCommands(pre, cwd) {
|
|
35492
35630
|
for (const cmd of pre) {
|
|
35493
35631
|
try {
|
|
35494
|
-
|
|
35632
|
+
execSync64(cmd, { stdio: "inherit", cwd });
|
|
35495
35633
|
} catch (error) {
|
|
35496
35634
|
const code = error && typeof error === "object" && "status" in error ? error.status : 1;
|
|
35497
35635
|
process.exit(code);
|
|
@@ -35870,7 +36008,7 @@ async function auth() {
|
|
|
35870
36008
|
// src/commands/roam/postRoamActivity.ts
|
|
35871
36009
|
import { execFileSync as execFileSync20 } from "child_process";
|
|
35872
36010
|
import { readdirSync as readdirSync22, readFileSync as readFileSync61, statSync as statSync12 } from "fs";
|
|
35873
|
-
import { join as
|
|
36011
|
+
import { join as join98 } from "path";
|
|
35874
36012
|
function findPortFile(roamDir) {
|
|
35875
36013
|
let entries;
|
|
35876
36014
|
try {
|
|
@@ -35879,7 +36017,7 @@ function findPortFile(roamDir) {
|
|
|
35879
36017
|
return void 0;
|
|
35880
36018
|
}
|
|
35881
36019
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
35882
|
-
const path91 =
|
|
36020
|
+
const path91 = join98(roamDir, name);
|
|
35883
36021
|
try {
|
|
35884
36022
|
return { path: path91, mtimeMs: statSync12(path91).mtimeMs };
|
|
35885
36023
|
} catch {
|
|
@@ -35896,7 +36034,7 @@ var PID_BY_APP = {
|
|
|
35896
36034
|
function postRoamActivity(app, event) {
|
|
35897
36035
|
const appData = process.env.APPDATA;
|
|
35898
36036
|
if (!appData) return;
|
|
35899
|
-
const portFile = findPortFile(
|
|
36037
|
+
const portFile = findPortFile(join98(appData, "Roam"));
|
|
35900
36038
|
if (!portFile) return;
|
|
35901
36039
|
let port;
|
|
35902
36040
|
try {
|
|
@@ -36031,8 +36169,8 @@ async function run3(name, args) {
|
|
|
36031
36169
|
}
|
|
36032
36170
|
|
|
36033
36171
|
// src/commands/run/add.ts
|
|
36034
|
-
import { mkdirSync as
|
|
36035
|
-
import { join as
|
|
36172
|
+
import { mkdirSync as mkdirSync34, writeFileSync as writeFileSync51 } from "fs";
|
|
36173
|
+
import { join as join99 } from "path";
|
|
36036
36174
|
|
|
36037
36175
|
// src/commands/run/extractOption.ts
|
|
36038
36176
|
function extractOption(args, flag) {
|
|
@@ -36093,16 +36231,16 @@ function saveNewRunConfig(name, command, args, cwd) {
|
|
|
36093
36231
|
saveConfig(config);
|
|
36094
36232
|
}
|
|
36095
36233
|
function createCommandFile(name) {
|
|
36096
|
-
const dir =
|
|
36097
|
-
|
|
36234
|
+
const dir = join99(".claude", "commands");
|
|
36235
|
+
mkdirSync34(dir, { recursive: true });
|
|
36098
36236
|
const content = `---
|
|
36099
36237
|
description: Run ${name}
|
|
36100
36238
|
---
|
|
36101
36239
|
|
|
36102
36240
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
36103
36241
|
`;
|
|
36104
|
-
const filePath =
|
|
36105
|
-
|
|
36242
|
+
const filePath = join99(dir, `${name}.md`);
|
|
36243
|
+
writeFileSync51(filePath, content);
|
|
36106
36244
|
console.log(`Created command file: ${filePath}`);
|
|
36107
36245
|
}
|
|
36108
36246
|
function add3() {
|
|
@@ -36158,7 +36296,7 @@ function link2() {
|
|
|
36158
36296
|
|
|
36159
36297
|
// src/commands/run/remove.ts
|
|
36160
36298
|
import { existsSync as existsSync84, unlinkSync as unlinkSync21 } from "fs";
|
|
36161
|
-
import { join as
|
|
36299
|
+
import { join as join100 } from "path";
|
|
36162
36300
|
function findRemoveIndex() {
|
|
36163
36301
|
const idx = process.argv.indexOf("remove");
|
|
36164
36302
|
if (idx === -1 || idx + 1 >= process.argv.length) return -1;
|
|
@@ -36173,7 +36311,7 @@ function parseRemoveName() {
|
|
|
36173
36311
|
return process.argv[idx + 1];
|
|
36174
36312
|
}
|
|
36175
36313
|
function deleteCommandFile(name) {
|
|
36176
|
-
const filePath =
|
|
36314
|
+
const filePath = join100(".claude", "commands", `${name}.md`);
|
|
36177
36315
|
if (existsSync84(filePath)) {
|
|
36178
36316
|
unlinkSync21(filePath);
|
|
36179
36317
|
console.log(`Deleted command file: ${filePath}`);
|
|
@@ -36218,10 +36356,10 @@ function registerRun(program2) {
|
|
|
36218
36356
|
}
|
|
36219
36357
|
|
|
36220
36358
|
// src/commands/screenshot/index.ts
|
|
36221
|
-
import { execSync as
|
|
36222
|
-
import { existsSync as existsSync85, mkdirSync as
|
|
36359
|
+
import { execSync as execSync65 } from "child_process";
|
|
36360
|
+
import { existsSync as existsSync85, mkdirSync as mkdirSync35, unlinkSync as unlinkSync22, writeFileSync as writeFileSync52 } from "fs";
|
|
36223
36361
|
import { tmpdir as tmpdir9 } from "os";
|
|
36224
|
-
import { join as
|
|
36362
|
+
import { join as join101, resolve as resolve21 } from "path";
|
|
36225
36363
|
import chalk233 from "chalk";
|
|
36226
36364
|
|
|
36227
36365
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -36352,16 +36490,16 @@ Write-Output $OutputPath
|
|
|
36352
36490
|
// src/commands/screenshot/index.ts
|
|
36353
36491
|
function buildOutputPath(outputDir, processName) {
|
|
36354
36492
|
if (!existsSync85(outputDir)) {
|
|
36355
|
-
|
|
36493
|
+
mkdirSync35(outputDir, { recursive: true });
|
|
36356
36494
|
}
|
|
36357
36495
|
const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
36358
36496
|
return resolve21(outputDir, `${processName}-${timestamp6}.png`);
|
|
36359
36497
|
}
|
|
36360
36498
|
function runPowerShellScript(processName, outputPath) {
|
|
36361
|
-
const scriptPath =
|
|
36362
|
-
|
|
36499
|
+
const scriptPath = join101(tmpdir9(), `assist-screenshot-${Date.now()}.ps1`);
|
|
36500
|
+
writeFileSync52(scriptPath, captureWindowPs1, "utf8");
|
|
36363
36501
|
try {
|
|
36364
|
-
|
|
36502
|
+
execSync65(
|
|
36365
36503
|
`powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
|
|
36366
36504
|
{ stdio: ["ignore", "pipe", "pipe"], encoding: "utf8" }
|
|
36367
36505
|
);
|
|
@@ -36592,7 +36730,7 @@ function requestDrain(socket, lines2) {
|
|
|
36592
36730
|
}
|
|
36593
36731
|
|
|
36594
36732
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
36595
|
-
import { mkdirSync as
|
|
36733
|
+
import { mkdirSync as mkdirSync39 } from "fs";
|
|
36596
36734
|
|
|
36597
36735
|
// src/commands/sessions/daemon/createAutoExit.ts
|
|
36598
36736
|
var DEFAULT_GRACE_MS = 6e4;
|
|
@@ -36852,7 +36990,7 @@ var ClientHub = class extends Set {
|
|
|
36852
36990
|
};
|
|
36853
36991
|
|
|
36854
36992
|
// src/commands/sessions/daemon/createSession.ts
|
|
36855
|
-
import { randomUUID as
|
|
36993
|
+
import { randomUUID as randomUUID19 } from "crypto";
|
|
36856
36994
|
|
|
36857
36995
|
// src/commands/sessions/daemon/sessionBase.ts
|
|
36858
36996
|
function sessionBase(id, status3) {
|
|
@@ -37048,7 +37186,7 @@ function spawnRun(opts) {
|
|
|
37048
37186
|
function createSession(id, { prompt, cwd, design, auto, harness, holdPty } = {}) {
|
|
37049
37187
|
if (harness && harness !== "claude")
|
|
37050
37188
|
return createHarnessSession(id, harness, prompt, cwd, holdPty);
|
|
37051
|
-
const claudeSessionId =
|
|
37189
|
+
const claudeSessionId = randomUUID19();
|
|
37052
37190
|
return {
|
|
37053
37191
|
...sessionBase(id, prompt ? "running" : "waiting"),
|
|
37054
37192
|
name: `Session ${id}`,
|
|
@@ -37113,12 +37251,12 @@ import { basename as basename25 } from "path";
|
|
|
37113
37251
|
|
|
37114
37252
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
37115
37253
|
import { existsSync as existsSync89 } from "fs";
|
|
37116
|
-
import { join as
|
|
37254
|
+
import { join as join104 } from "path";
|
|
37117
37255
|
|
|
37118
37256
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
37119
37257
|
import { statSync as statSync14 } from "fs";
|
|
37120
37258
|
import { rm as rm4 } from "fs/promises";
|
|
37121
|
-
import { join as
|
|
37259
|
+
import { join as join103 } from "path";
|
|
37122
37260
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
37123
37261
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
37124
37262
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -37146,7 +37284,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
37146
37284
|
return { removed: true };
|
|
37147
37285
|
}
|
|
37148
37286
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
37149
|
-
return statSync14(
|
|
37287
|
+
return statSync14(join103(worktreePath, ".git"), {
|
|
37150
37288
|
throwIfNoEntry: false
|
|
37151
37289
|
})?.isDirectory() === true;
|
|
37152
37290
|
}
|
|
@@ -37182,7 +37320,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
37182
37320
|
);
|
|
37183
37321
|
}
|
|
37184
37322
|
function strandedReason(worktreePath, cause) {
|
|
37185
|
-
if (!existsSync89(
|
|
37323
|
+
if (!existsSync89(join104(worktreePath, ".git")))
|
|
37186
37324
|
return "its .git link is already gone";
|
|
37187
37325
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
37188
37326
|
return "git no longer recognises it as a working tree";
|
|
@@ -37617,8 +37755,9 @@ function decidePrPreview(sessions, waiters, notify2, d) {
|
|
|
37617
37755
|
}
|
|
37618
37756
|
const commentCount = Array.isArray(d.comments) ? d.comments.length : 0;
|
|
37619
37757
|
const screenshotCount = Array.isArray(d.screenshots) ? d.screenshots.length : 0;
|
|
37758
|
+
const checklistCount = Array.isArray(d.checklist) ? d.checklist.length : 0;
|
|
37620
37759
|
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}`
|
|
37760
|
+
`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
37761
|
);
|
|
37623
37762
|
const waiter = waiters.get(id);
|
|
37624
37763
|
if (waiter)
|
|
@@ -37633,7 +37772,8 @@ function decidePrPreview(sessions, waiters, notify2, d) {
|
|
|
37633
37772
|
reviewAfter: d.reviewAfter,
|
|
37634
37773
|
announceAfter: d.announceAfter,
|
|
37635
37774
|
draft: d.draft,
|
|
37636
|
-
autoMerge: d.autoMerge
|
|
37775
|
+
autoMerge: d.autoMerge,
|
|
37776
|
+
checklist: d.checklist
|
|
37637
37777
|
});
|
|
37638
37778
|
waiters.delete(id);
|
|
37639
37779
|
session.pendingPrPreview = void 0;
|
|
@@ -37650,7 +37790,8 @@ var PREVIEW_KINDS = [
|
|
|
37650
37790
|
"github-issue-comment",
|
|
37651
37791
|
"github-issue-edit",
|
|
37652
37792
|
"miro-board",
|
|
37653
|
-
"slack-post"
|
|
37793
|
+
"slack-post",
|
|
37794
|
+
"high-level-review"
|
|
37654
37795
|
];
|
|
37655
37796
|
function isPreviewKind(value) {
|
|
37656
37797
|
return PREVIEW_KINDS.includes(value);
|
|
@@ -37675,6 +37816,7 @@ function previewTargetLabel(kind, itemType, prNumber, draft) {
|
|
|
37675
37816
|
if (kind === "github-issue") return "github issue";
|
|
37676
37817
|
if (kind === "miro-board") return "miro anchors";
|
|
37677
37818
|
if (kind === "slack-post") return "slack post";
|
|
37819
|
+
if (kind === "high-level-review") return "high-level review";
|
|
37678
37820
|
if (kind === "backlog-item") return `backlog ${itemType}`;
|
|
37679
37821
|
if (prNumber !== null) return `edit #${prNumber}`;
|
|
37680
37822
|
return draft ? "create draft" : "create";
|
|
@@ -37940,8 +38082,8 @@ function handleFailedResume(session, exitCode, onStatusChange) {
|
|
|
37940
38082
|
}
|
|
37941
38083
|
|
|
37942
38084
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
37943
|
-
import { existsSync as existsSync93, mkdirSync as
|
|
37944
|
-
import { dirname as
|
|
38085
|
+
import { existsSync as existsSync93, mkdirSync as mkdirSync36, watch as watch2 } from "fs";
|
|
38086
|
+
import { dirname as dirname41 } from "path";
|
|
37945
38087
|
|
|
37946
38088
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
37947
38089
|
function applyActivityToSession(session, activity2) {
|
|
@@ -38003,9 +38145,9 @@ var DEBOUNCE_MS2 = 50;
|
|
|
38003
38145
|
function watchActivity(session, notify2, onClaudeSessionId) {
|
|
38004
38146
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
38005
38147
|
const path91 = activityPath(session.id);
|
|
38006
|
-
const dir =
|
|
38148
|
+
const dir = dirname41(path91);
|
|
38007
38149
|
try {
|
|
38008
|
-
|
|
38150
|
+
mkdirSync36(dir, { recursive: true });
|
|
38009
38151
|
} catch {
|
|
38010
38152
|
return;
|
|
38011
38153
|
}
|
|
@@ -38208,10 +38350,10 @@ function headContainsSessionId(filePath, claudeSessionId) {
|
|
|
38208
38350
|
}
|
|
38209
38351
|
|
|
38210
38352
|
// src/commands/sessions/daemon/ensureProjectDirExists.ts
|
|
38211
|
-
import { mkdirSync as
|
|
38353
|
+
import { mkdirSync as mkdirSync37 } from "fs";
|
|
38212
38354
|
function ensureProjectDirExists(dir, sessionId) {
|
|
38213
38355
|
try {
|
|
38214
|
-
|
|
38356
|
+
mkdirSync37(dir, { recursive: true });
|
|
38215
38357
|
return true;
|
|
38216
38358
|
} catch (error) {
|
|
38217
38359
|
daemonLog(
|
|
@@ -39160,7 +39302,7 @@ function codexRespawnPlan(session) {
|
|
|
39160
39302
|
}
|
|
39161
39303
|
|
|
39162
39304
|
// src/commands/sessions/daemon/interactiveRespawnPlan.ts
|
|
39163
|
-
import { randomUUID as
|
|
39305
|
+
import { randomUUID as randomUUID20 } from "crypto";
|
|
39164
39306
|
function interactiveRespawnPlan(session, resumes) {
|
|
39165
39307
|
const { claudeSessionId, cwd, initialPrompt, design, auto } = session;
|
|
39166
39308
|
if (!resumes) return null;
|
|
@@ -39180,7 +39322,7 @@ function interactiveRespawnPlan(session, resumes) {
|
|
|
39180
39322
|
return null;
|
|
39181
39323
|
}
|
|
39182
39324
|
function freshClaudePlan(session, prompt, cwd) {
|
|
39183
|
-
const claudeSessionId =
|
|
39325
|
+
const claudeSessionId = randomUUID20();
|
|
39184
39326
|
return {
|
|
39185
39327
|
spawn: () => {
|
|
39186
39328
|
session.claudeSessionId = claudeSessionId;
|
|
@@ -40137,10 +40279,10 @@ function startReusedRunPty(session, assistArgs, itemId2, hold, clients, onStatus
|
|
|
40137
40279
|
}
|
|
40138
40280
|
|
|
40139
40281
|
// src/commands/sessions/daemon/createWatcherSession.ts
|
|
40140
|
-
import { randomUUID as
|
|
40282
|
+
import { randomUUID as randomUUID21 } from "crypto";
|
|
40141
40283
|
var WATCH_PROMPT = "/watch";
|
|
40142
40284
|
function createWatcherSession(id, cwd) {
|
|
40143
|
-
const claudeSessionId =
|
|
40285
|
+
const claudeSessionId = randomUUID21();
|
|
40144
40286
|
return {
|
|
40145
40287
|
...sessionBase(id, "running"),
|
|
40146
40288
|
name: `Session ${id}`,
|
|
@@ -41391,8 +41533,8 @@ function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
|
41391
41533
|
import { existsSync as existsSync99 } from "fs";
|
|
41392
41534
|
|
|
41393
41535
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
41394
|
-
import { copyFileSync as copyFileSync5, existsSync as existsSync98, mkdirSync as
|
|
41395
|
-
import { join as
|
|
41536
|
+
import { copyFileSync as copyFileSync5, existsSync as existsSync98, mkdirSync as mkdirSync38 } from "fs";
|
|
41537
|
+
import { join as join106 } from "path";
|
|
41396
41538
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
41397
41539
|
const dir = projectDirForCwd(toCwd);
|
|
41398
41540
|
if (dir === projectDirForCwd(fromCwd)) {
|
|
@@ -41401,7 +41543,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
41401
41543
|
);
|
|
41402
41544
|
return;
|
|
41403
41545
|
}
|
|
41404
|
-
const dest =
|
|
41546
|
+
const dest = join106(dir, `${claudeSessionId}.jsonl`);
|
|
41405
41547
|
if (existsSync98(dest)) {
|
|
41406
41548
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
41407
41549
|
return;
|
|
@@ -41414,7 +41556,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
41414
41556
|
return;
|
|
41415
41557
|
}
|
|
41416
41558
|
try {
|
|
41417
|
-
|
|
41559
|
+
mkdirSync38(dir, { recursive: true });
|
|
41418
41560
|
copyFileSync5(source, dest);
|
|
41419
41561
|
daemonLog(
|
|
41420
41562
|
`transcript ${source} copied to ${dest} so ${toCwd} can resume it`
|
|
@@ -42045,7 +42187,7 @@ function handleConnection(socket, manager) {
|
|
|
42045
42187
|
}
|
|
42046
42188
|
|
|
42047
42189
|
// src/commands/sessions/daemon/onListening.ts
|
|
42048
|
-
import { unlinkSync as unlinkSync23, writeFileSync as
|
|
42190
|
+
import { unlinkSync as unlinkSync23, writeFileSync as writeFileSync53 } from "fs";
|
|
42049
42191
|
|
|
42050
42192
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
42051
42193
|
import { readFileSync as readFileSync65 } from "fs";
|
|
@@ -42067,7 +42209,7 @@ function ownsPidFile() {
|
|
|
42067
42209
|
|
|
42068
42210
|
// src/commands/sessions/daemon/onListening.ts
|
|
42069
42211
|
function onListening(manager, checkAutoExit) {
|
|
42070
|
-
|
|
42212
|
+
writeFileSync53(daemonPaths.pid, String(process.pid));
|
|
42071
42213
|
startPidFileWatchdog(() => {
|
|
42072
42214
|
daemonLog("lost daemon.pid ownership; shutting down sessions and exiting");
|
|
42073
42215
|
void manager.flushActiveMs().finally(() => {
|
|
@@ -42254,7 +42396,7 @@ async function recoverFromAddrInUse(server, manager, checkAutoExit) {
|
|
|
42254
42396
|
|
|
42255
42397
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
42256
42398
|
async function runDaemon() {
|
|
42257
|
-
|
|
42399
|
+
mkdirSync39(daemonPaths.dir, { recursive: true });
|
|
42258
42400
|
daemonLog(
|
|
42259
42401
|
`starting (reason: ${process.env.ASSIST_DAEMON_SPAWN_REASON ?? "manual"})`
|
|
42260
42402
|
);
|
|
@@ -42553,9 +42695,9 @@ function buildLimitsSegment(rateLimits) {
|
|
|
42553
42695
|
|
|
42554
42696
|
// src/commands/readGitBranch.ts
|
|
42555
42697
|
import { readFileSync as readFileSync67, statSync as statSync16 } from "fs";
|
|
42556
|
-
import { isAbsolute as isAbsolute5, join as
|
|
42698
|
+
import { isAbsolute as isAbsolute5, join as join107, resolve as resolve23 } from "path";
|
|
42557
42699
|
function resolveGitDir(cwd) {
|
|
42558
|
-
const dotGit =
|
|
42700
|
+
const dotGit = join107(cwd, ".git");
|
|
42559
42701
|
let stat4;
|
|
42560
42702
|
try {
|
|
42561
42703
|
stat4 = statSync16(dotGit);
|
|
@@ -42585,7 +42727,7 @@ function readGitBranch(cwd) {
|
|
|
42585
42727
|
}
|
|
42586
42728
|
let head;
|
|
42587
42729
|
try {
|
|
42588
|
-
head = readFileSync67(
|
|
42730
|
+
head = readFileSync67(join107(gitDir, "HEAD"), "utf8");
|
|
42589
42731
|
} catch {
|
|
42590
42732
|
return null;
|
|
42591
42733
|
}
|
|
@@ -42653,7 +42795,7 @@ async function statusLine() {
|
|
|
42653
42795
|
}
|
|
42654
42796
|
|
|
42655
42797
|
// src/commands/update.ts
|
|
42656
|
-
import { execSync as
|
|
42798
|
+
import { execSync as execSync66 } from "child_process";
|
|
42657
42799
|
import * as path90 from "path";
|
|
42658
42800
|
|
|
42659
42801
|
// src/commands/restartDaemonAfterUpdate.ts
|
|
@@ -42677,7 +42819,7 @@ function isGlobalNpmInstall(dir) {
|
|
|
42677
42819
|
if (resolved.split(path90.sep).includes("node_modules")) {
|
|
42678
42820
|
return true;
|
|
42679
42821
|
}
|
|
42680
|
-
const globalPrefix =
|
|
42822
|
+
const globalPrefix = execSync66("npm prefix -g", { stdio: "pipe" }).toString().trim();
|
|
42681
42823
|
return resolved.toLowerCase().startsWith(path90.resolve(globalPrefix).toLowerCase());
|
|
42682
42824
|
} catch {
|
|
42683
42825
|
return false;
|
|
@@ -42688,18 +42830,18 @@ async function update2() {
|
|
|
42688
42830
|
console.log(`Assist is installed at: ${installDir}`);
|
|
42689
42831
|
if (isGitRepo(installDir)) {
|
|
42690
42832
|
console.log("Detected git repo installation, pulling latest...");
|
|
42691
|
-
|
|
42833
|
+
execSync66("git pull", { cwd: installDir, stdio: "inherit" });
|
|
42692
42834
|
console.log("Installing dependencies...");
|
|
42693
|
-
|
|
42835
|
+
execSync66("npm i", { cwd: installDir, stdio: "inherit" });
|
|
42694
42836
|
console.log("Building...");
|
|
42695
|
-
|
|
42837
|
+
execSync66("npm run build", { cwd: installDir, stdio: "inherit" });
|
|
42696
42838
|
console.log("Syncing commands...");
|
|
42697
|
-
|
|
42839
|
+
execSync66("assist sync", { stdio: "inherit" });
|
|
42698
42840
|
} else if (isGlobalNpmInstall(installDir)) {
|
|
42699
42841
|
console.log("Detected global npm installation, updating...");
|
|
42700
|
-
|
|
42842
|
+
execSync66("npm i -g @staff0rd/assist@latest", { stdio: "inherit" });
|
|
42701
42843
|
console.log("Syncing commands...");
|
|
42702
|
-
|
|
42844
|
+
execSync66("assist sync", { stdio: "inherit" });
|
|
42703
42845
|
} else {
|
|
42704
42846
|
console.error(
|
|
42705
42847
|
"Could not determine installation method. Expected a git repo or global npm install."
|