@staff0rd/assist 0.784.2 → 0.785.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/sessions/web/bundle.js +188 -188
- package/dist/index.js +25 -20
- 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.785.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -14166,6 +14166,7 @@ function toNextPr(node, author, requested, viewer) {
|
|
|
14166
14166
|
author,
|
|
14167
14167
|
createdAt: node.createdAt,
|
|
14168
14168
|
url: node.url,
|
|
14169
|
+
isDraft: node.isDraft,
|
|
14169
14170
|
requestedAt: requested ? lastRequestedAt(node, viewer) : node.createdAt,
|
|
14170
14171
|
reason: requested ? "requested" : "peer",
|
|
14171
14172
|
checks: rollup && CHECK_STATES[rollup] || null
|
|
@@ -15167,7 +15168,7 @@ var getOpenPrs = createCachedGhJson(
|
|
|
15167
15168
|
"--state",
|
|
15168
15169
|
"open",
|
|
15169
15170
|
"--json",
|
|
15170
|
-
"number,title,author,createdAt,url"
|
|
15171
|
+
"number,title,author,createdAt,url,isDraft"
|
|
15171
15172
|
],
|
|
15172
15173
|
(stdout) => {
|
|
15173
15174
|
const parsed = JSON.parse(stdout);
|
|
@@ -15177,7 +15178,8 @@ var getOpenPrs = createCachedGhJson(
|
|
|
15177
15178
|
title: pr.title,
|
|
15178
15179
|
author: pr.author?.name || pr.author?.login || "unknown",
|
|
15179
15180
|
createdAt: pr.createdAt,
|
|
15180
|
-
url: pr.url
|
|
15181
|
+
url: pr.url,
|
|
15182
|
+
isDraft: pr.isDraft === true
|
|
15181
15183
|
}));
|
|
15182
15184
|
},
|
|
15183
15185
|
[]
|
|
@@ -15382,10 +15384,25 @@ async function previewImage(req, res) {
|
|
|
15382
15384
|
createReadStream2(path106).pipe(res);
|
|
15383
15385
|
}
|
|
15384
15386
|
|
|
15385
|
-
// src/commands/sessions/web/
|
|
15387
|
+
// src/commands/sessions/web/getCurrentBranch.ts
|
|
15386
15388
|
import { execFile as execFile8 } from "child_process";
|
|
15387
15389
|
import { promisify as promisify9 } from "util";
|
|
15388
15390
|
var execFileAsync8 = promisify9(execFile8);
|
|
15391
|
+
async function getCurrentBranch(cwd) {
|
|
15392
|
+
try {
|
|
15393
|
+
const { stdout } = await execFileAsync8(
|
|
15394
|
+
"git",
|
|
15395
|
+
["rev-parse", "--abbrev-ref", "HEAD"],
|
|
15396
|
+
{ encoding: "utf8", windowsHide: true, cwd }
|
|
15397
|
+
);
|
|
15398
|
+
const branch2 = stdout.trim();
|
|
15399
|
+
return branch2 && branch2 !== "HEAD" ? branch2 : void 0;
|
|
15400
|
+
} catch {
|
|
15401
|
+
return void 0;
|
|
15402
|
+
}
|
|
15403
|
+
}
|
|
15404
|
+
|
|
15405
|
+
// src/commands/sessions/web/prStatus.ts
|
|
15389
15406
|
function toPrSummary(parsed) {
|
|
15390
15407
|
if (typeof parsed.number !== "number") return null;
|
|
15391
15408
|
return {
|
|
@@ -15393,10 +15410,11 @@ function toPrSummary(parsed) {
|
|
|
15393
15410
|
title: parsed.title ?? "",
|
|
15394
15411
|
author: parsed.author?.name || parsed.author?.login || "unknown",
|
|
15395
15412
|
createdAt: parsed.createdAt ?? "",
|
|
15396
|
-
url: parsed.url ?? ""
|
|
15413
|
+
url: parsed.url ?? "",
|
|
15414
|
+
isDraft: parsed.isDraft === true
|
|
15397
15415
|
};
|
|
15398
15416
|
}
|
|
15399
|
-
var prFields = "number,title,author,createdAt,url";
|
|
15417
|
+
var prFields = "number,title,author,createdAt,url,isDraft";
|
|
15400
15418
|
var getPrByNumber = createCachedGhJson(
|
|
15401
15419
|
["pr", "view", "--json", prFields],
|
|
15402
15420
|
(stdout) => toPrSummary(JSON.parse(stdout)),
|
|
@@ -15413,19 +15431,6 @@ var getOpenPrForBranch = createCachedGhJson(
|
|
|
15413
15431
|
null,
|
|
15414
15432
|
{ cacheFallback: false }
|
|
15415
15433
|
);
|
|
15416
|
-
async function getCurrentBranch(cwd) {
|
|
15417
|
-
try {
|
|
15418
|
-
const { stdout } = await execFileAsync8(
|
|
15419
|
-
"git",
|
|
15420
|
-
["rev-parse", "--abbrev-ref", "HEAD"],
|
|
15421
|
-
{ encoding: "utf8", windowsHide: true, cwd }
|
|
15422
|
-
);
|
|
15423
|
-
const branch2 = stdout.trim();
|
|
15424
|
-
return branch2 && branch2 !== "HEAD" ? branch2 : void 0;
|
|
15425
|
-
} catch {
|
|
15426
|
-
return void 0;
|
|
15427
|
-
}
|
|
15428
|
-
}
|
|
15429
15434
|
function getNumberParam(req) {
|
|
15430
15435
|
const raw = new URL(req.url ?? "/", "http://localhost").searchParams.get(
|
|
15431
15436
|
"number"
|
|
@@ -18872,7 +18877,7 @@ var PATTERN_DENIES = [
|
|
|
18872
18877
|
var GH_ISSUE_API_MESSAGE = "Do not write to GitHub issues with 'gh api' (REST issue endpoints or GraphQL issue mutations) \u2014 it bypasses the content validation and the approval pane that every outward-facing issue write goes through. Use 'assist github issue create --title <title> --body <body>' to open an issue, 'assist github issue edit <number>' to rework one's body, 'assist github issue comment <number> --body <body>' to post a comment, or 'assist github issue edit-comment <comment-id> --body <body>' to amend a comment that is already posted. Each validates the content and gates it on the user's approval before anything reaches GitHub; run the command's --help for how to compose it.";
|
|
18873
18878
|
var BRANCH_CREATION_MESSAGE = "Do not create branches with raw git. Use the /branch command, or 'assist branch <slug> [--jira <KEY>]' \u2014 it branches off the fresh remote default and enforces the team naming convention.";
|
|
18874
18879
|
var CLOSE_WITH_COMMENT_MESSAGE = "Do not post a comment through 'gh issue close', 'gh issue reopen' or 'gh pr close' with --comment/-c \u2014 it goes to GitHub without the approval pane. Post the comment first with 'assist github issue comment <number> --body <body> [-R <owner>/<repo>]', which validates it and gates it on the user's approval, then run the same close/reopen without --comment.";
|
|
18875
|
-
var CLOSE_WITH_COMMENT_REGEX = /(?<=^|\s)gh\s+(?:issue\s+(?:close|reopen)|pr\s+close)(?=\s|$)[^;&|\n]*?\s(?:--comment
|
|
18880
|
+
var CLOSE_WITH_COMMENT_REGEX = /(?<=^|\s)gh\s+(?:issue\s+(?:close|reopen)|pr\s+close)(?=\s|$)[^;&|\n]*?\s(?:--comment(?=[\s=]|$)|-c)/;
|
|
18876
18881
|
var COMMAND_BOUNDARY = String.raw`(?<=(?:^|[;&|(\n])\s*)`;
|
|
18877
18882
|
var BRANCH_CREATION_REGEXES = [
|
|
18878
18883
|
new RegExp(
|