@staff0rd/assist 0.727.1 → 0.729.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 +5 -1
- package/dist/commands/sessions/web/bundle.js +408 -408
- package/dist/index.js +96 -35
- 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.729.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -857,7 +857,9 @@ var assistConfigShape = {
|
|
|
857
857
|
showInNav: z3.boolean().default(false)
|
|
858
858
|
}).optional(),
|
|
859
859
|
next: z3.strictObject({
|
|
860
|
-
peers: z3.array(z3.string()).optional()
|
|
860
|
+
peers: z3.array(z3.string()).optional(),
|
|
861
|
+
prRepos: z3.array(z3.string()).optional(),
|
|
862
|
+
issueRepos: z3.array(z3.string()).optional()
|
|
861
863
|
}).optional(),
|
|
862
864
|
deny: z3.array(
|
|
863
865
|
z3.strictObject({
|
|
@@ -10343,13 +10345,13 @@ function phaseNotes(entry, position) {
|
|
|
10343
10345
|
}
|
|
10344
10346
|
function renderDiffPhase(entry, idx) {
|
|
10345
10347
|
const notes = phaseNotes(entry, idx + 1);
|
|
10346
|
-
const
|
|
10348
|
+
const section2 = renderPhaseSection(
|
|
10347
10349
|
{ ...entry.phase, name: `${entry.phase.name} (${notes.join(", ")})` },
|
|
10348
10350
|
idx
|
|
10349
10351
|
);
|
|
10350
|
-
if (!entry.previousTasks) return
|
|
10352
|
+
if (!entry.previousTasks) return section2;
|
|
10351
10353
|
return [
|
|
10352
|
-
|
|
10354
|
+
section2,
|
|
10353
10355
|
"**Previously:**",
|
|
10354
10356
|
entry.previousTasks.map((task) => `- ${task}`).join("\n")
|
|
10355
10357
|
].join("\n\n");
|
|
@@ -12562,6 +12564,16 @@ var nextConfigHelp = [
|
|
|
12562
12564
|
key: "next.peers",
|
|
12563
12565
|
setter: "assist config set next.peers alice,bob -g --repo",
|
|
12564
12566
|
note: "GitHub logins whose open, non-draft PRs the web /next view lists for review alongside PRs requesting your review; PRs you approved with no newer commits are hidden"
|
|
12567
|
+
},
|
|
12568
|
+
{
|
|
12569
|
+
key: "next.prRepos",
|
|
12570
|
+
setter: "assist config set next.prRepos owner/api,owner/web -g --repo",
|
|
12571
|
+
note: "owner/name GitHub repos the web /next view reads peer PRs from (default: the selected repo)"
|
|
12572
|
+
},
|
|
12573
|
+
{
|
|
12574
|
+
key: "next.issueRepos",
|
|
12575
|
+
setter: "assist config set next.issueRepos owner/api,owner/web -g --repo",
|
|
12576
|
+
note: "owner/name GitHub repos the web /next view reads issues assigned to you from (default: the selected repo)"
|
|
12565
12577
|
}
|
|
12566
12578
|
];
|
|
12567
12579
|
|
|
@@ -13700,10 +13712,12 @@ function ghJson(cwd, args) {
|
|
|
13700
13712
|
}
|
|
13701
13713
|
|
|
13702
13714
|
// src/commands/sessions/web/next/fetchAssignedIssues.ts
|
|
13703
|
-
async function fetchAssignedIssues(cwd) {
|
|
13715
|
+
async function fetchAssignedIssues(cwd, repo) {
|
|
13704
13716
|
const issues = await ghJson(cwd, [
|
|
13705
13717
|
"issue",
|
|
13706
13718
|
"list",
|
|
13719
|
+
"--repo",
|
|
13720
|
+
repo,
|
|
13707
13721
|
"--assignee",
|
|
13708
13722
|
"@me",
|
|
13709
13723
|
"--state",
|
|
@@ -13714,6 +13728,7 @@ async function fetchAssignedIssues(cwd) {
|
|
|
13714
13728
|
"number,title,url,createdAt,author,labels"
|
|
13715
13729
|
]);
|
|
13716
13730
|
return issues.map((issue) => ({
|
|
13731
|
+
repo,
|
|
13717
13732
|
number: issue.number,
|
|
13718
13733
|
title: issue.title,
|
|
13719
13734
|
url: issue.url,
|
|
@@ -13722,7 +13737,7 @@ async function fetchAssignedIssues(cwd) {
|
|
|
13722
13737
|
labels: (issue.labels ?? []).flatMap(
|
|
13723
13738
|
(label2) => label2.name ? [label2.name] : []
|
|
13724
13739
|
)
|
|
13725
|
-
}))
|
|
13740
|
+
}));
|
|
13726
13741
|
}
|
|
13727
13742
|
|
|
13728
13743
|
// src/commands/sessions/web/next/peerPrsQuery.ts
|
|
@@ -13822,16 +13837,17 @@ function selectPeerPrs(nodes, viewer, peers) {
|
|
|
13822
13837
|
}
|
|
13823
13838
|
|
|
13824
13839
|
// src/commands/sessions/web/next/fetchPeerPrs.ts
|
|
13825
|
-
async function fetchPeerPrs(cwd, peers) {
|
|
13840
|
+
async function fetchPeerPrs(cwd, repo, peers) {
|
|
13841
|
+
const [owner, name] = repo.split("/");
|
|
13826
13842
|
const response = await ghJson(cwd, [
|
|
13827
13843
|
"api",
|
|
13828
13844
|
"graphql",
|
|
13829
13845
|
"-f",
|
|
13830
13846
|
`query=${peerPrsQuery}`,
|
|
13831
13847
|
"-F",
|
|
13832
|
-
|
|
13848
|
+
`owner=${owner}`,
|
|
13833
13849
|
"-F",
|
|
13834
|
-
|
|
13850
|
+
`name=${name}`
|
|
13835
13851
|
]);
|
|
13836
13852
|
const viewer = response.data?.viewer?.login;
|
|
13837
13853
|
const repository = response.data?.repository;
|
|
@@ -13839,31 +13855,76 @@ async function fetchPeerPrs(cwd, peers) {
|
|
|
13839
13855
|
const nodes = (repository.pullRequests?.nodes ?? []).filter(
|
|
13840
13856
|
(node) => !!node
|
|
13841
13857
|
);
|
|
13842
|
-
return selectPeerPrs(nodes, viewer, peers);
|
|
13858
|
+
return selectPeerPrs(nodes, viewer, peers).map((pr) => ({ ...pr, repo }));
|
|
13843
13859
|
}
|
|
13844
13860
|
|
|
13845
|
-
// src/commands/sessions/web/next/
|
|
13861
|
+
// src/commands/sessions/web/next/nextScope.ts
|
|
13862
|
+
var GITHUB = "github.com/";
|
|
13863
|
+
function githubRepo(cwd) {
|
|
13864
|
+
const { origin } = resolveCurrentOrigin(cwd);
|
|
13865
|
+
return origin.startsWith(GITHUB) ? origin.slice(GITHUB.length) : null;
|
|
13866
|
+
}
|
|
13867
|
+
function nextScope(cwd) {
|
|
13868
|
+
const next3 = loadConfigFrom(cwd).next;
|
|
13869
|
+
return {
|
|
13870
|
+
selfRepo: githubRepo(cwd),
|
|
13871
|
+
peers: next3?.peers ?? [],
|
|
13872
|
+
prRepos: next3?.prRepos ?? null,
|
|
13873
|
+
issueRepos: next3?.issueRepos ?? null
|
|
13874
|
+
};
|
|
13875
|
+
}
|
|
13876
|
+
|
|
13877
|
+
// src/commands/sessions/web/next/scopeRepos.ts
|
|
13878
|
+
function scopeRepos(configured, selfRepo) {
|
|
13879
|
+
if (configured) return configured;
|
|
13880
|
+
return selfRepo ? [selfRepo] : [];
|
|
13881
|
+
}
|
|
13882
|
+
|
|
13883
|
+
// src/commands/sessions/web/next/sectionAcross.ts
|
|
13846
13884
|
function errorMessage(error) {
|
|
13847
13885
|
const stderr = error.stderr;
|
|
13848
13886
|
if (typeof stderr === "string" && stderr.trim()) return stderr.trim();
|
|
13849
13887
|
return error instanceof Error ? error.message : String(error);
|
|
13850
13888
|
}
|
|
13851
|
-
async function
|
|
13852
|
-
|
|
13853
|
-
return {
|
|
13854
|
-
|
|
13855
|
-
|
|
13856
|
-
|
|
13889
|
+
async function sectionAcross(repos2, load3, compare, unsetKey) {
|
|
13890
|
+
if (repos2.length === 0)
|
|
13891
|
+
return {
|
|
13892
|
+
items: [],
|
|
13893
|
+
error: `No GitHub repo to read: set ${unsetKey} or select a repo with a GitHub origin.`
|
|
13894
|
+
};
|
|
13895
|
+
const results = await Promise.allSettled(repos2.map((repo) => load3(repo)));
|
|
13896
|
+
const items2 = [];
|
|
13897
|
+
const errors = [];
|
|
13898
|
+
results.forEach((result, index3) => {
|
|
13899
|
+
if (result.status === "fulfilled") items2.push(...result.value);
|
|
13900
|
+
else errors.push(`${repos2[index3]}: ${errorMessage(result.reason)}`);
|
|
13901
|
+
});
|
|
13902
|
+
return {
|
|
13903
|
+
items: items2.sort(compare),
|
|
13904
|
+
error: errors.length > 0 ? errors.join("\n") : null
|
|
13905
|
+
};
|
|
13857
13906
|
}
|
|
13907
|
+
|
|
13908
|
+
// src/commands/sessions/web/next/nextItems.ts
|
|
13858
13909
|
async function nextItems(req, res) {
|
|
13859
13910
|
const cwd = getCwdParam(req, res);
|
|
13860
13911
|
if (!cwd) return;
|
|
13861
|
-
const
|
|
13912
|
+
const scope = nextScope(cwd);
|
|
13862
13913
|
const [peerPrs, assignedIssues] = await Promise.all([
|
|
13863
|
-
|
|
13864
|
-
|
|
13914
|
+
sectionAcross(
|
|
13915
|
+
scopeRepos(scope.prRepos, scope.selfRepo),
|
|
13916
|
+
(repo) => fetchPeerPrs(cwd, repo, scope.peers),
|
|
13917
|
+
(a, b) => a.requestedAt.localeCompare(b.requestedAt),
|
|
13918
|
+
"next.prRepos"
|
|
13919
|
+
),
|
|
13920
|
+
sectionAcross(
|
|
13921
|
+
scopeRepos(scope.issueRepos, scope.selfRepo),
|
|
13922
|
+
(repo) => fetchAssignedIssues(cwd, repo),
|
|
13923
|
+
(a, b) => a.createdAt.localeCompare(b.createdAt),
|
|
13924
|
+
"next.issueRepos"
|
|
13925
|
+
)
|
|
13865
13926
|
]);
|
|
13866
|
-
const body = { peerPrs, assignedIssues };
|
|
13927
|
+
const body = { scope, peerPrs, assignedIssues };
|
|
13867
13928
|
respondJson(res, 200, body);
|
|
13868
13929
|
}
|
|
13869
13930
|
|
|
@@ -27741,9 +27802,9 @@ function parsePrBody(body) {
|
|
|
27741
27802
|
return sections;
|
|
27742
27803
|
}
|
|
27743
27804
|
function serializePrBody(sections) {
|
|
27744
|
-
return sections.map((
|
|
27805
|
+
return sections.map((section2) => `## ${section2.heading}
|
|
27745
27806
|
|
|
27746
|
-
${
|
|
27807
|
+
${section2.content}`).join("\n\n");
|
|
27747
27808
|
}
|
|
27748
27809
|
|
|
27749
27810
|
// src/commands/prs/editPrBody.ts
|
|
@@ -27792,11 +27853,11 @@ function findWallOfText(body) {
|
|
|
27792
27853
|
}
|
|
27793
27854
|
function splitParagraphs(body) {
|
|
27794
27855
|
const paragraphs = [];
|
|
27795
|
-
let
|
|
27856
|
+
let section2 = "(intro)";
|
|
27796
27857
|
let lines2 = [];
|
|
27797
27858
|
const flush = () => {
|
|
27798
27859
|
if (lines2.length > 0) {
|
|
27799
|
-
paragraphs.push({ section:
|
|
27860
|
+
paragraphs.push({ section: section2, lines: lines2 });
|
|
27800
27861
|
lines2 = [];
|
|
27801
27862
|
}
|
|
27802
27863
|
};
|
|
@@ -27804,7 +27865,7 @@ function splitParagraphs(body) {
|
|
|
27804
27865
|
const heading2 = line.match(/^#{1,6}\s+(.*)$/);
|
|
27805
27866
|
if (heading2) {
|
|
27806
27867
|
flush();
|
|
27807
|
-
|
|
27868
|
+
section2 = heading2[1].trim();
|
|
27808
27869
|
} else if (line.trim() === "") {
|
|
27809
27870
|
flush();
|
|
27810
27871
|
} else {
|
|
@@ -31206,13 +31267,13 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
31206
31267
|
// src/commands/refactor/extract/displayPlan.ts
|
|
31207
31268
|
import path50 from "path";
|
|
31208
31269
|
import chalk207 from "chalk";
|
|
31209
|
-
function
|
|
31270
|
+
function section(title) {
|
|
31210
31271
|
return `
|
|
31211
31272
|
${chalk207.cyan(title)}`;
|
|
31212
31273
|
}
|
|
31213
31274
|
function displayImporters(plan2, cwd) {
|
|
31214
31275
|
if (plan2.importersToUpdate.length === 0) return;
|
|
31215
|
-
console.log(
|
|
31276
|
+
console.log(section("Update importers:"));
|
|
31216
31277
|
for (const imp of plan2.importersToUpdate) {
|
|
31217
31278
|
const rel = path50.relative(cwd, imp.file.getFilePath());
|
|
31218
31279
|
console.log(` ${chalk207.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
@@ -31226,18 +31287,18 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
31226
31287
|
console.log(` ${name}`);
|
|
31227
31288
|
}
|
|
31228
31289
|
if (plan2.imports.length > 0) {
|
|
31229
|
-
console.log(
|
|
31290
|
+
console.log(section("Imports to copy:"));
|
|
31230
31291
|
for (const imp of plan2.imports) {
|
|
31231
31292
|
console.log(` ${formatImportLine(imp)}`);
|
|
31232
31293
|
}
|
|
31233
31294
|
}
|
|
31234
31295
|
if (plan2.exportedDeps.length > 0) {
|
|
31235
|
-
console.log(
|
|
31296
|
+
console.log(section("New imports from source:"));
|
|
31236
31297
|
console.log(
|
|
31237
31298
|
` import { ${plan2.exportedDeps.join(", ")} } from "${plan2.sourceRelPath}";`
|
|
31238
31299
|
);
|
|
31239
31300
|
}
|
|
31240
|
-
console.log(
|
|
31301
|
+
console.log(section("Source file changes:"));
|
|
31241
31302
|
console.log(` Remove: ${plan2.extractedNames.join(", ")}`);
|
|
31242
31303
|
if (plan2.sourceNeedsReimport) {
|
|
31243
31304
|
console.log(
|
|
@@ -31246,7 +31307,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
31246
31307
|
}
|
|
31247
31308
|
displayImporters(plan2, cwd);
|
|
31248
31309
|
if (plan2.barrel) {
|
|
31249
|
-
console.log(
|
|
31310
|
+
console.log(section("Barrel export:"));
|
|
31250
31311
|
console.log(
|
|
31251
31312
|
` Add: export { ${functionName} } from "${plan2.barrelRelPath}";`
|
|
31252
31313
|
);
|
|
@@ -33004,10 +33065,10 @@ function checkDescriptionLinksIssue(body) {
|
|
|
33004
33065
|
|
|
33005
33066
|
// src/commands/review/highLevel/checkDescriptionSections.ts
|
|
33006
33067
|
function sectionContent(body, heading2) {
|
|
33007
|
-
const
|
|
33068
|
+
const section2 = parsePrBody(body).find(
|
|
33008
33069
|
(candidate) => candidate.heading.trim().toLowerCase() === heading2
|
|
33009
33070
|
);
|
|
33010
|
-
return
|
|
33071
|
+
return section2 ? section2.content.trim() : null;
|
|
33011
33072
|
}
|
|
33012
33073
|
function describe5(heading2, content) {
|
|
33013
33074
|
if (content === null) return `no \`## ${heading2}\` section`;
|