@staff0rd/assist 0.605.0 → 0.606.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 +376 -376
- package/dist/index.js +291 -50
- 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.606.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -21693,6 +21693,25 @@ function registerCommentIssue(issueCommand) {
|
|
|
21693
21693
|
);
|
|
21694
21694
|
}
|
|
21695
21695
|
|
|
21696
|
+
// src/commands/github/issue/collectLabels.ts
|
|
21697
|
+
function collectLabels(value, previous) {
|
|
21698
|
+
const added = value.split(",").map((label2) => label2.trim()).filter((label2) => label2.length > 0);
|
|
21699
|
+
return [...previous, ...added];
|
|
21700
|
+
}
|
|
21701
|
+
|
|
21702
|
+
// src/commands/github/issue/addIssueToProject.ts
|
|
21703
|
+
var MUTATION3 = `mutation($projectId: ID!, $contentId: ID!) {
|
|
21704
|
+
addProjectV2ItemById(input: { projectId: $projectId, contentId: $contentId }) {
|
|
21705
|
+
item { id }
|
|
21706
|
+
}
|
|
21707
|
+
}`;
|
|
21708
|
+
function addIssueToProject(projectId, contentId) {
|
|
21709
|
+
const raw = runGhGraphqlJson(MUTATION3, { projectId, contentId });
|
|
21710
|
+
const id = JSON.parse(raw).data?.addProjectV2ItemById?.item?.id;
|
|
21711
|
+
if (!id) throw new Error("The project returned no item for the issue");
|
|
21712
|
+
return id;
|
|
21713
|
+
}
|
|
21714
|
+
|
|
21696
21715
|
// src/commands/github/issue/fetchIssueNodeId.ts
|
|
21697
21716
|
var QUERY4 = `query($owner: String!, $repo: String!, $number: Int!) {
|
|
21698
21717
|
repository(owner: $owner, name: $repo) {
|
|
@@ -21727,30 +21746,113 @@ function parseCreatedIssueUrl(output) {
|
|
|
21727
21746
|
};
|
|
21728
21747
|
}
|
|
21729
21748
|
|
|
21730
|
-
// src/commands/github/issue/
|
|
21731
|
-
|
|
21732
|
-
|
|
21733
|
-
|
|
21734
|
-
|
|
21749
|
+
// src/commands/github/issue/setProjectItemStatus.ts
|
|
21750
|
+
var MUTATION4 = `mutation($projectId: ID!, $itemId: ID!, $fieldId: ID!, $optionId: String!) {
|
|
21751
|
+
updateProjectV2ItemFieldValue(input: {
|
|
21752
|
+
projectId: $projectId
|
|
21753
|
+
itemId: $itemId
|
|
21754
|
+
fieldId: $fieldId
|
|
21755
|
+
value: { singleSelectOptionId: $optionId }
|
|
21756
|
+
}) {
|
|
21757
|
+
projectV2Item { id }
|
|
21758
|
+
}
|
|
21759
|
+
}`;
|
|
21760
|
+
function setProjectItemStatus(input) {
|
|
21761
|
+
runGhGraphqlJson(MUTATION4, input);
|
|
21762
|
+
}
|
|
21763
|
+
|
|
21764
|
+
// src/commands/github/issue/applyCreatedIssueMetadata.ts
|
|
21765
|
+
function applyCreatedIssueMetadata(createOutput, metadata2) {
|
|
21766
|
+
let step2 = "identifying the created issue";
|
|
21767
|
+
try {
|
|
21768
|
+
const issueId = fetchIssueNodeId(parseCreatedIssueUrl(createOutput));
|
|
21769
|
+
const { issueType, project } = metadata2;
|
|
21770
|
+
if (issueType) {
|
|
21771
|
+
step2 = `setting its issue type to ${issueType.name}`;
|
|
21772
|
+
updateIssueType(issueId, issueType.id);
|
|
21773
|
+
}
|
|
21774
|
+
if (project) {
|
|
21775
|
+
step2 = `adding it to project ${project.number} (${project.title})`;
|
|
21776
|
+
const itemId2 = addIssueToProject(project.id, issueId);
|
|
21777
|
+
if (project.status) {
|
|
21778
|
+
step2 = `setting its status to ${project.status.optionName}`;
|
|
21779
|
+
setProjectItemStatus({
|
|
21780
|
+
projectId: project.id,
|
|
21781
|
+
itemId: itemId2,
|
|
21782
|
+
fieldId: project.status.fieldId,
|
|
21783
|
+
optionId: project.status.optionId
|
|
21784
|
+
});
|
|
21785
|
+
}
|
|
21786
|
+
}
|
|
21735
21787
|
} catch (error) {
|
|
21736
21788
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
21737
21789
|
console.error(
|
|
21738
|
-
`The issue was created at ${createOutput.trim()}, but
|
|
21790
|
+
`The issue was created at ${createOutput.trim()}, but ${step2} failed: ${message3}`
|
|
21739
21791
|
);
|
|
21740
21792
|
process.exit(1);
|
|
21741
21793
|
}
|
|
21742
21794
|
}
|
|
21743
21795
|
|
|
21744
|
-
// src/commands/github/issue/
|
|
21745
|
-
function
|
|
21746
|
-
if (!
|
|
21747
|
-
const
|
|
21748
|
-
|
|
21749
|
-
|
|
21750
|
-
|
|
21751
|
-
|
|
21796
|
+
// src/commands/github/issue/issuePreviewMetadata.ts
|
|
21797
|
+
function issuePreviewMetadata(resolved) {
|
|
21798
|
+
if (!resolved) return [];
|
|
21799
|
+
const { target, issueType, project, labels } = resolved;
|
|
21800
|
+
const items2 = [
|
|
21801
|
+
{ label: "Repository", value: `${target.owner}/${target.repo}` }
|
|
21802
|
+
];
|
|
21803
|
+
if (issueType) items2.push({ label: "Type", value: issueType.name });
|
|
21804
|
+
if (project)
|
|
21805
|
+
items2.push({
|
|
21806
|
+
label: "Project",
|
|
21807
|
+
value: `${project.number} (${project.title})`
|
|
21808
|
+
});
|
|
21809
|
+
if (project?.status)
|
|
21810
|
+
items2.push({ label: "Status", value: project.status.optionName });
|
|
21811
|
+
if (labels?.length) items2.push({ label: "Labels", value: labels.join(", ") });
|
|
21812
|
+
return items2;
|
|
21813
|
+
}
|
|
21752
21814
|
|
|
21753
|
-
|
|
21815
|
+
// src/commands/github/issue/resolveIssueLabels.ts
|
|
21816
|
+
var QUERY5 = `query($owner: String!, $repo: String!, $after: String) {
|
|
21817
|
+
repository(owner: $owner, name: $repo) {
|
|
21818
|
+
labels(first: 100, after: $after) {
|
|
21819
|
+
nodes { name }
|
|
21820
|
+
pageInfo { hasNextPage endCursor }
|
|
21821
|
+
}
|
|
21822
|
+
}
|
|
21823
|
+
}`;
|
|
21824
|
+
function readRepoLabels(target) {
|
|
21825
|
+
const names = [];
|
|
21826
|
+
let after;
|
|
21827
|
+
do {
|
|
21828
|
+
const page = JSON.parse(
|
|
21829
|
+
runGhGraphqlJson(QUERY5, { ...target, after })
|
|
21830
|
+
).data?.repository?.labels;
|
|
21831
|
+
if (!page) {
|
|
21832
|
+
throw new Error(
|
|
21833
|
+
`No labels could be read for ${target.owner}/${target.repo}`
|
|
21834
|
+
);
|
|
21835
|
+
}
|
|
21836
|
+
for (const node of page.nodes ?? []) if (node?.name) names.push(node.name);
|
|
21837
|
+
after = page.pageInfo?.hasNextPage ? page.pageInfo.endCursor ?? void 0 : void 0;
|
|
21838
|
+
} while (after);
|
|
21839
|
+
return names;
|
|
21840
|
+
}
|
|
21841
|
+
function matchLabel(names, wanted) {
|
|
21842
|
+
const normalised = normaliseTypeName(wanted);
|
|
21843
|
+
return names.find((name) => name === wanted) ?? names.find((name) => name.toLowerCase() === wanted.toLowerCase()) ?? names.find((name) => normaliseTypeName(name) === normalised);
|
|
21844
|
+
}
|
|
21845
|
+
function resolveIssueLabels(target, wanted) {
|
|
21846
|
+
const names = readRepoLabels(target);
|
|
21847
|
+
return wanted.map((label2) => {
|
|
21848
|
+
const match = matchLabel(names, label2);
|
|
21849
|
+
if (!match) {
|
|
21850
|
+
throw new Error(
|
|
21851
|
+
`${target.owner}/${target.repo} has no ${label2} label. It has ${names.join(", ")}`
|
|
21852
|
+
);
|
|
21853
|
+
}
|
|
21854
|
+
return match;
|
|
21855
|
+
});
|
|
21754
21856
|
}
|
|
21755
21857
|
|
|
21756
21858
|
// src/commands/prs/shared.ts
|
|
@@ -21845,19 +21947,139 @@ function resolveIssueRepoTarget(repo) {
|
|
|
21845
21947
|
return parseRepoSlug(repo);
|
|
21846
21948
|
}
|
|
21847
21949
|
|
|
21848
|
-
// src/commands/github/issue/
|
|
21849
|
-
|
|
21850
|
-
|
|
21851
|
-
|
|
21852
|
-
|
|
21853
|
-
|
|
21950
|
+
// src/commands/github/issue/readGhTokenScopes.ts
|
|
21951
|
+
import { spawnSync as spawnSync6 } from "child_process";
|
|
21952
|
+
var SCOPES_LINE = /Token scopes:\s*(.*)/;
|
|
21953
|
+
function readGhTokenScopes() {
|
|
21954
|
+
const result = spawnSync6("gh", ["auth", "status"], {
|
|
21955
|
+
encoding: "utf8",
|
|
21956
|
+
windowsHide: true
|
|
21957
|
+
});
|
|
21958
|
+
const match = SCOPES_LINE.exec(
|
|
21959
|
+
`${result.stdout ?? ""}
|
|
21960
|
+
${result.stderr ?? ""}`
|
|
21961
|
+
);
|
|
21962
|
+
if (!match) return void 0;
|
|
21963
|
+
return (match[1] ?? "").split(",").map((scope) => scope.trim().replace(/^'|'$/g, "")).filter((scope) => scope.length > 0);
|
|
21964
|
+
}
|
|
21965
|
+
|
|
21966
|
+
// src/commands/github/issue/assertProjectScope.ts
|
|
21967
|
+
function assertProjectScope() {
|
|
21968
|
+
const scopes = readGhTokenScopes();
|
|
21969
|
+
if (!scopes || scopes.includes("project")) return;
|
|
21970
|
+
throw new Error(
|
|
21971
|
+
`The gh token has no project scope, so a project cannot be read or written. It has ${scopes.join(", ") || "no scopes"}. Run: gh auth refresh -h github.com -s project`
|
|
21854
21972
|
);
|
|
21855
|
-
|
|
21973
|
+
}
|
|
21974
|
+
|
|
21975
|
+
// src/commands/github/issue/projectV2Query.ts
|
|
21976
|
+
function projectV2Query(root) {
|
|
21977
|
+
return `query($owner: String!, $number: Int!) {
|
|
21978
|
+
${root}(login: $owner) {
|
|
21979
|
+
projectV2(number: $number) {
|
|
21980
|
+
id
|
|
21981
|
+
title
|
|
21982
|
+
field(name: "Status") {
|
|
21983
|
+
... on ProjectV2SingleSelectField { id options { id name } }
|
|
21984
|
+
}
|
|
21985
|
+
}
|
|
21986
|
+
}
|
|
21987
|
+
}`;
|
|
21988
|
+
}
|
|
21989
|
+
|
|
21990
|
+
// src/commands/github/issue/readProject.ts
|
|
21991
|
+
function readProject(owner, number, root) {
|
|
21992
|
+
let raw;
|
|
21993
|
+
try {
|
|
21994
|
+
raw = runGhGraphqlJson(projectV2Query(root), { owner, number });
|
|
21995
|
+
} catch (error) {
|
|
21996
|
+
const message3 = error instanceof Error ? error.message : String(error);
|
|
21997
|
+
if (root === "organization" && message3.includes("Could not resolve to an")) {
|
|
21998
|
+
return void 0;
|
|
21999
|
+
}
|
|
22000
|
+
throw error;
|
|
22001
|
+
}
|
|
22002
|
+
const project = JSON.parse(raw).data?.[root]?.projectV2;
|
|
22003
|
+
if (!project?.id) return void 0;
|
|
22004
|
+
const field = project.field;
|
|
22005
|
+
return {
|
|
22006
|
+
id: project.id,
|
|
22007
|
+
number,
|
|
22008
|
+
title: project.title ?? String(number),
|
|
22009
|
+
statusField: field?.id ? { id: field.id, options: field.options ?? [] } : void 0
|
|
22010
|
+
};
|
|
22011
|
+
}
|
|
22012
|
+
|
|
22013
|
+
// src/commands/github/issue/fetchProjectV2.ts
|
|
22014
|
+
function fetchProjectV2(owner, number) {
|
|
22015
|
+
const project = readProject(owner, number, "organization") ?? readProject(owner, number, "user");
|
|
22016
|
+
if (!project) {
|
|
22017
|
+
throw new Error(`No project ${number} owned by ${owner} could be read`);
|
|
22018
|
+
}
|
|
22019
|
+
return project;
|
|
22020
|
+
}
|
|
22021
|
+
|
|
22022
|
+
// src/commands/github/issue/resolveCreateIssueProject.ts
|
|
22023
|
+
function parseProjectNumber(value) {
|
|
22024
|
+
const number = Number(value);
|
|
22025
|
+
if (!Number.isInteger(number) || number <= 0) {
|
|
22026
|
+
throw new Error(
|
|
22027
|
+
`--project takes a project number, not ${value}. It is the number in the project's URL, e.g. 1 for /orgs/acme/projects/1`
|
|
22028
|
+
);
|
|
22029
|
+
}
|
|
22030
|
+
return number;
|
|
22031
|
+
}
|
|
22032
|
+
function resolveStatus(project, statusName) {
|
|
22033
|
+
const field = project.statusField;
|
|
22034
|
+
if (!field) {
|
|
22035
|
+
throw new Error(
|
|
22036
|
+
`Project ${project.number} (${project.title}) has no Status single-select field`
|
|
22037
|
+
);
|
|
22038
|
+
}
|
|
22039
|
+
const wanted = normaliseTypeName(statusName);
|
|
22040
|
+
const option = field.options.find(
|
|
22041
|
+
(candidate) => normaliseTypeName(candidate.name) === wanted
|
|
22042
|
+
);
|
|
22043
|
+
if (!option) {
|
|
22044
|
+
throw new Error(
|
|
22045
|
+
`Project ${project.number} (${project.title}) has no ${statusName} status. It has ${field.options.map((candidate) => candidate.name).join(", ")}`
|
|
22046
|
+
);
|
|
22047
|
+
}
|
|
22048
|
+
return { fieldId: field.id, optionId: option.id, optionName: option.name };
|
|
22049
|
+
}
|
|
22050
|
+
function resolveCreateIssueProject(owner, projectNumber, statusName) {
|
|
22051
|
+
assertProjectScope();
|
|
22052
|
+
const project = fetchProjectV2(owner, parseProjectNumber(projectNumber));
|
|
22053
|
+
return {
|
|
22054
|
+
id: project.id,
|
|
22055
|
+
number: project.number,
|
|
22056
|
+
title: project.title,
|
|
22057
|
+
status: statusName ? resolveStatus(project, statusName) : void 0
|
|
22058
|
+
};
|
|
22059
|
+
}
|
|
22060
|
+
|
|
22061
|
+
// src/commands/github/issue/resolveCreateIssueMetadata.ts
|
|
22062
|
+
function resolveCreateIssueMetadata(options2) {
|
|
22063
|
+
const labels = options2.label ?? [];
|
|
22064
|
+
if (!options2.type && !options2.project && !options2.status && !labels.length)
|
|
22065
|
+
return void 0;
|
|
22066
|
+
if (options2.status && !options2.project) {
|
|
22067
|
+
throw new Error(
|
|
22068
|
+
"--status is a field on a project board, so it needs --project <number>"
|
|
22069
|
+
);
|
|
22070
|
+
}
|
|
22071
|
+
const target = resolveIssueRepoTarget(options2.repo);
|
|
22072
|
+
return {
|
|
22073
|
+
target,
|
|
22074
|
+
issueType: options2.type ? resolveIssueType(resolveOrgIssueTypes(target.owner), options2.type) : void 0,
|
|
22075
|
+
project: options2.project ? resolveCreateIssueProject(target.owner, options2.project, options2.status) : void 0,
|
|
22076
|
+
labels: labels.length ? resolveIssueLabels(target, labels) : void 0
|
|
22077
|
+
};
|
|
21856
22078
|
}
|
|
21857
22079
|
|
|
21858
22080
|
// src/commands/github/issue/reviewProposedIssue.ts
|
|
21859
22081
|
import { randomUUID as randomUUID8 } from "crypto";
|
|
21860
|
-
async function reviewProposedIssue(title, body) {
|
|
22082
|
+
async function reviewProposedIssue(title, body, metadata2 = []) {
|
|
21861
22083
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
21862
22084
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
|
|
21863
22085
|
await awaitPreviewApproval("GitHub issue preview", {
|
|
@@ -21866,15 +22088,17 @@ async function reviewProposedIssue(title, body) {
|
|
|
21866
22088
|
title,
|
|
21867
22089
|
body,
|
|
21868
22090
|
prNumber: null,
|
|
21869
|
-
kind: "github-issue"
|
|
22091
|
+
kind: "github-issue",
|
|
22092
|
+
metadata: metadata2.length ? metadata2 : void 0
|
|
21870
22093
|
});
|
|
21871
22094
|
}
|
|
21872
22095
|
|
|
21873
22096
|
// src/commands/github/issue/runGhIssueCreate.ts
|
|
21874
22097
|
import { execFileSync as execFileSync7 } from "child_process";
|
|
21875
|
-
function runGhIssueCreate(title, body, repo) {
|
|
22098
|
+
function runGhIssueCreate(title, body, repo, labels) {
|
|
21876
22099
|
const args = ["issue", "create", "--title", title, "--body", body];
|
|
21877
22100
|
if (repo) args.push("--repo", repo);
|
|
22101
|
+
for (const label2 of labels ?? []) args.push("--label", label2);
|
|
21878
22102
|
try {
|
|
21879
22103
|
return execFileSync7("gh", args, {
|
|
21880
22104
|
encoding: "utf8",
|
|
@@ -21886,11 +22110,10 @@ function runGhIssueCreate(title, body, repo) {
|
|
|
21886
22110
|
}
|
|
21887
22111
|
|
|
21888
22112
|
// src/commands/github/issue/createIssue.ts
|
|
21889
|
-
var USAGE2 = "Usage: assist github issue create --title <title> --body <body> [-R <owner>/<repo>] [--type <name>]";
|
|
22113
|
+
var USAGE2 = "Usage: assist github issue create --title <title> --body <body> [-R <owner>/<repo>] [--type <name>] [--project <number>] [--status <name>] [--label <name>]";
|
|
21890
22114
|
function preflight(options2) {
|
|
21891
|
-
if (!options2.type) return void 0;
|
|
21892
22115
|
try {
|
|
21893
|
-
return
|
|
22116
|
+
return resolveCreateIssueMetadata(options2);
|
|
21894
22117
|
} catch (error) {
|
|
21895
22118
|
console.error(error instanceof Error ? error.message : String(error));
|
|
21896
22119
|
process.exit(1);
|
|
@@ -21908,14 +22131,10 @@ async function createIssue(options2) {
|
|
|
21908
22131
|
body
|
|
21909
22132
|
);
|
|
21910
22133
|
const resolved = preflight(options2);
|
|
21911
|
-
|
|
21912
|
-
|
|
21913
|
-
type: resolved.issueType.name
|
|
21914
|
-
};
|
|
21915
|
-
await reviewProposedIssue(title, buildIssuePreviewBody(metadata2, body));
|
|
21916
|
-
const output = runGhIssueCreate(title, body, options2.repo);
|
|
22134
|
+
await reviewProposedIssue(title, body, issuePreviewMetadata(resolved));
|
|
22135
|
+
const output = runGhIssueCreate(title, body, options2.repo, resolved?.labels);
|
|
21917
22136
|
console.log(output.trim());
|
|
21918
|
-
if (resolved)
|
|
22137
|
+
if (resolved) applyCreatedIssueMetadata(output, resolved);
|
|
21919
22138
|
}
|
|
21920
22139
|
|
|
21921
22140
|
// src/commands/github/issue/registerCreateIssue.ts
|
|
@@ -21926,9 +22145,20 @@ function registerCreateIssue(issueCommand) {
|
|
|
21926
22145
|
).option(
|
|
21927
22146
|
"--type <name>",
|
|
21928
22147
|
"Native issue type to set on the new issue (e.g. Epic)"
|
|
22148
|
+
).option(
|
|
22149
|
+
"--project <number>",
|
|
22150
|
+
"Number of the repo owner's GitHub Project to add the new issue to"
|
|
22151
|
+
).option(
|
|
22152
|
+
"--status <name>",
|
|
22153
|
+
"Status option to set on the project item (requires --project)"
|
|
22154
|
+
).option(
|
|
22155
|
+
"--label <name>",
|
|
22156
|
+
"Label to apply (repeat the flag, or pass a comma-separated list)",
|
|
22157
|
+
collectLabels,
|
|
22158
|
+
[]
|
|
21929
22159
|
).addHelpText(
|
|
21930
22160
|
"after",
|
|
21931
|
-
"\nThere is no What/Why/How template: an issue reports a problem, and the target repo's own issue template is unknowable from here. Write the body as the repo's maintainers would expect.\nIn an assist web session the title and body are previewed for approve/reject first (with inline comments); nothing is created until it is approved.\n--type
|
|
22161
|
+
"\nThere is no What/Why/How template: an issue reports a problem, and the target repo's own issue template is unknowable from here. Write the body as the repo's maintainers would expect.\nIn an assist web session the title and body are previewed for approve/reject first (with inline comments); nothing is created until it is approved.\n--type, --project, --status and --label are all resolved before the preview, so an unknown name, a missing project scope or --status without --project creates nothing.\nThe project scope is needed for --project: gh auth refresh -h github.com -s project"
|
|
21932
22162
|
).action(createIssue);
|
|
21933
22163
|
}
|
|
21934
22164
|
|
|
@@ -25102,9 +25332,9 @@ function deleteCommentsCache(org, repo, prNumber) {
|
|
|
25102
25332
|
}
|
|
25103
25333
|
|
|
25104
25334
|
// src/commands/prs/replyToComment.ts
|
|
25105
|
-
import { spawnSync as
|
|
25335
|
+
import { spawnSync as spawnSync7 } from "child_process";
|
|
25106
25336
|
function replyToComment(org, repo, prNumber, commentId, message3) {
|
|
25107
|
-
const result =
|
|
25337
|
+
const result = spawnSync7(
|
|
25108
25338
|
"gh",
|
|
25109
25339
|
[
|
|
25110
25340
|
"api",
|
|
@@ -28846,15 +29076,15 @@ function runReviewSubmission(mutation, body) {
|
|
|
28846
29076
|
}
|
|
28847
29077
|
|
|
28848
29078
|
// src/commands/review/submitBodyOnlyReview.ts
|
|
28849
|
-
var
|
|
29079
|
+
var MUTATION5 = `mutation($prId: ID!, $body: String) { addPullRequestReview(input: { pullRequestId: $prId, event: COMMENT, body: $body }) { pullRequestReview { id } } }`;
|
|
28850
29080
|
function submitBodyOnlyReview(body) {
|
|
28851
|
-
runReviewSubmission(
|
|
29081
|
+
runReviewSubmission(MUTATION5, body);
|
|
28852
29082
|
}
|
|
28853
29083
|
|
|
28854
29084
|
// src/commands/review/submitPendingReview.ts
|
|
28855
|
-
var
|
|
29085
|
+
var MUTATION6 = `mutation($prId: ID!, $body: String) { submitPullRequestReview(input: { pullRequestId: $prId, event: COMMENT, body: $body }) { pullRequestReview { id } } }`;
|
|
28856
29086
|
function submitPendingReview(body) {
|
|
28857
|
-
runReviewSubmission(
|
|
29087
|
+
runReviewSubmission(MUTATION6, body);
|
|
28858
29088
|
}
|
|
28859
29089
|
|
|
28860
29090
|
// src/commands/review/postAndMaybeSubmit.ts
|
|
@@ -29355,9 +29585,9 @@ var MultiSpinner = class {
|
|
|
29355
29585
|
};
|
|
29356
29586
|
|
|
29357
29587
|
// src/commands/review/ensureCodexAvailable.ts
|
|
29358
|
-
import { spawnSync as
|
|
29588
|
+
import { spawnSync as spawnSync8 } from "child_process";
|
|
29359
29589
|
function runNpmInstall() {
|
|
29360
|
-
const result =
|
|
29590
|
+
const result = spawnSync8("npm", ["install", "-g", "@openai/codex"], {
|
|
29361
29591
|
stdio: "inherit",
|
|
29362
29592
|
shell: true
|
|
29363
29593
|
});
|
|
@@ -31993,7 +32223,7 @@ function registerVerify(program2) {
|
|
|
31993
32223
|
}
|
|
31994
32224
|
|
|
31995
32225
|
// src/commands/voice/devices.ts
|
|
31996
|
-
import { spawnSync as
|
|
32226
|
+
import { spawnSync as spawnSync9 } from "child_process";
|
|
31997
32227
|
import { join as join86 } from "path";
|
|
31998
32228
|
|
|
31999
32229
|
// src/commands/voice/shared.ts
|
|
@@ -32026,7 +32256,7 @@ function getLockFile() {
|
|
|
32026
32256
|
// src/commands/voice/devices.ts
|
|
32027
32257
|
function devices() {
|
|
32028
32258
|
const script = join86(getPythonDir(), "list_devices.py");
|
|
32029
|
-
|
|
32259
|
+
spawnSync9(getVenvPython(), [script], { stdio: "inherit" });
|
|
32030
32260
|
}
|
|
32031
32261
|
|
|
32032
32262
|
// src/commands/voice/logs.ts
|
|
@@ -32058,7 +32288,7 @@ function logs(options2) {
|
|
|
32058
32288
|
}
|
|
32059
32289
|
|
|
32060
32290
|
// src/commands/voice/setup.ts
|
|
32061
|
-
import { spawnSync as
|
|
32291
|
+
import { spawnSync as spawnSync10 } from "child_process";
|
|
32062
32292
|
import { mkdirSync as mkdirSync29 } from "fs";
|
|
32063
32293
|
import { join as join88 } from "path";
|
|
32064
32294
|
|
|
@@ -32119,7 +32349,7 @@ function setup() {
|
|
|
32119
32349
|
bootstrapVenv();
|
|
32120
32350
|
console.log("\nDownloading models...\n");
|
|
32121
32351
|
const script = join88(getPythonDir(), "setup_models.py");
|
|
32122
|
-
const result =
|
|
32352
|
+
const result = spawnSync10(getVenvPython(), [script], {
|
|
32123
32353
|
stdio: "inherit",
|
|
32124
32354
|
env: { ...process.env, VOICE_LOG_FILE: voicePaths.log }
|
|
32125
32355
|
});
|
|
@@ -34878,6 +35108,16 @@ function isPreviewKind(value) {
|
|
|
34878
35108
|
return PREVIEW_KINDS.includes(value);
|
|
34879
35109
|
}
|
|
34880
35110
|
|
|
35111
|
+
// src/commands/sessions/daemon/parsePreviewMetadata.ts
|
|
35112
|
+
function parsePreviewMetadata(value) {
|
|
35113
|
+
if (!Array.isArray(value)) return void 0;
|
|
35114
|
+
const items2 = value.flatMap((entry) => {
|
|
35115
|
+
const { label: label2, value: text18 } = entry ?? {};
|
|
35116
|
+
return typeof label2 === "string" && typeof text18 === "string" ? [{ label: label2, value: text18 }] : [];
|
|
35117
|
+
});
|
|
35118
|
+
return items2.length > 0 ? items2 : void 0;
|
|
35119
|
+
}
|
|
35120
|
+
|
|
34881
35121
|
// src/commands/sessions/daemon/previewTargetLabel.ts
|
|
34882
35122
|
function previewTargetLabel(kind, itemType, prNumber, draft) {
|
|
34883
35123
|
if (kind === "backlog-comment") return "backlog comment";
|
|
@@ -34914,7 +35154,8 @@ function setPrPreview(sessions, waiters, notify2, client, d) {
|
|
|
34914
35154
|
prNumber,
|
|
34915
35155
|
kind,
|
|
34916
35156
|
itemType: kind === "backlog-item" ? itemType : void 0,
|
|
34917
|
-
draft: kind === "pr" && prNumber === null ? draft : void 0
|
|
35157
|
+
draft: kind === "pr" && prNumber === null ? draft : void 0,
|
|
35158
|
+
metadata: parsePreviewMetadata(d.metadata)
|
|
34918
35159
|
};
|
|
34919
35160
|
waiters.set(id, client);
|
|
34920
35161
|
const target = previewTargetLabel(kind, itemType, prNumber, draft);
|