@staff0rd/assist 0.1065.3 → 0.1067.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/claude/advice/code-comments.md +1 -1
- package/claude/commands/strip-code-comments.md +2 -1
- package/dist/built-version +1 -1
- package/dist/commands/extension/extension/content.js +1 -1
- package/dist/commands/extension/extension/docs.js +1 -1
- package/dist/commands/extension/extension/updates.json +2 -2
- package/dist/commands/sessions/web/bundle.js +352 -352
- package/dist/index.js +32 -8
- 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.1067.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -22683,7 +22683,7 @@ function stripEnvPrefix(parts) {
|
|
|
22683
22683
|
|
|
22684
22684
|
// src/commands/cliHook/isGhGraphqlIssueMutation.ts
|
|
22685
22685
|
import { readFileSync as readFileSync30 } from "fs";
|
|
22686
|
-
var ISSUE_MUTATION = /\bmutation\b[\s\S]*(?:issue|comment|label|assign|reaction|milestone)/i;
|
|
22686
|
+
var ISSUE_MUTATION = /\bmutation\b[\s\S]*(?:issue|comment|review|label|assign|reaction|milestone)/i;
|
|
22687
22687
|
var FILE_REFERENCE = /(?:=@|--input[\s=]+)["']?([^\s"';&|)]+)/g;
|
|
22688
22688
|
function isGhGraphqlIssueMutation(command) {
|
|
22689
22689
|
if (!command.includes("graphql")) return false;
|
|
@@ -22700,20 +22700,29 @@ function readOrEmpty(path109) {
|
|
|
22700
22700
|
}
|
|
22701
22701
|
}
|
|
22702
22702
|
|
|
22703
|
-
// src/commands/cliHook/
|
|
22703
|
+
// src/commands/cliHook/isGhRestWrite.ts
|
|
22704
22704
|
var WRITE_METHODS = /* @__PURE__ */ new Set(["POST", "PATCH", "PUT", "DELETE"]);
|
|
22705
22705
|
var METHOD = /(?:-X|--method)[\s=]*["']?([A-Za-z]+)/g;
|
|
22706
22706
|
var BODY_FLAG = /\s(?:-[fF]|--field|--raw-field|--input)/;
|
|
22707
|
+
function isGhRestWrite(command, endpoint) {
|
|
22708
|
+
if (!/gh\s+api/.test(command) || !endpoint.test(command)) return false;
|
|
22709
|
+
const methods = [...command.matchAll(METHOD)].map((m) => m[1].toUpperCase());
|
|
22710
|
+
if (methods.length > 0) return methods.some((m) => WRITE_METHODS.has(m));
|
|
22711
|
+
return BODY_FLAG.test(command);
|
|
22712
|
+
}
|
|
22713
|
+
|
|
22714
|
+
// src/commands/cliHook/isGhIssueApiWrite.ts
|
|
22707
22715
|
var ISSUE_ENDPOINT = /repos\/[^/\s"'`]+\/[^/\s"'`]+\/issues(?:$|[/?\s"'`)])/;
|
|
22708
22716
|
function isGhIssueApiWrite(command) {
|
|
22709
22717
|
if (!/gh\s+api/.test(command)) return false;
|
|
22710
|
-
if (
|
|
22718
|
+
if (isGhRestWrite(command, ISSUE_ENDPOINT)) return true;
|
|
22711
22719
|
return isGhGraphqlIssueMutation(command);
|
|
22712
22720
|
}
|
|
22713
|
-
|
|
22714
|
-
|
|
22715
|
-
|
|
22716
|
-
|
|
22721
|
+
|
|
22722
|
+
// src/commands/cliHook/isGhPullReviewApiWrite.ts
|
|
22723
|
+
var PULL_REVIEW_ENDPOINT = /repos\/[^/\s"'`]+\/[^/\s"'`]+\/pulls\/(?:\d+\/)?(?:comments|reviews)(?:$|[/?\s"'`)])/;
|
|
22724
|
+
function isGhPullReviewApiWrite(command) {
|
|
22725
|
+
return isGhRestWrite(command, PULL_REVIEW_ENDPOINT);
|
|
22717
22726
|
}
|
|
22718
22727
|
|
|
22719
22728
|
// src/commands/cliHook/builtinDenyRules.ts
|
|
@@ -22738,6 +22747,10 @@ var PATTERN_DENIES = [
|
|
|
22738
22747
|
pattern: "gh issue comment",
|
|
22739
22748
|
message: "Do not run 'gh issue comment' directly. Use 'assist github issue comment <number> --body <body> [-R <owner>/<repo>]' instead \u2014 it validates the body before delegating to gh, and gates the comment on the user's approval itself. Run 'assist github issue comment --help' and follow its guidance to compose the body; it is authoritative on how approval is handled in this environment."
|
|
22740
22749
|
},
|
|
22750
|
+
{
|
|
22751
|
+
pattern: "gh pr comment",
|
|
22752
|
+
message: "Do not run 'gh pr comment' directly \u2014 it posts to the PR without the approval pane. Use 'assist github issue comment <number> --body <body> [-R <owner>/<repo>]' instead (PR numbers are issue numbers) \u2014 it validates the body before delegating to gh, and gates the comment on the user's approval itself. To reply in a review thread, use 'assist prs reply <comment-id> <body>'. Run the command's --help and follow its guidance; it is authoritative on how approval is handled in this environment."
|
|
22753
|
+
},
|
|
22741
22754
|
{
|
|
22742
22755
|
pattern: "git commit",
|
|
22743
22756
|
message: `Do not run 'git commit' directly. Use 'assist commit "<message>"' instead.`
|
|
@@ -22752,6 +22765,9 @@ var GH_ISSUE_API_MESSAGE = "Do not write to GitHub issues with 'gh api' (REST is
|
|
|
22752
22765
|
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.";
|
|
22753
22766
|
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.";
|
|
22754
22767
|
var CLOSE_WITH_COMMENT_REGEX = /gh (?:issue (?:close|reopen)|pr close)[^;&|]*? (?:--comment|-c)/;
|
|
22768
|
+
var PR_REVIEW_MESSAGE = "Do not run 'gh pr review' with a body or a verdict (--comment, --approve, --request-changes) \u2014 it posts to the PR without the approval pane. To reply on the PR conversation, use 'assist github issue comment <number> --body <body> [-R <owner>/<repo>]' (PR numbers are issue numbers); to reply in a review thread, use 'assist prs reply <comment-id> <body>'; to add a line comment to the pending review, use 'assist prs comment <path> <line> <body>'. Each gates the text on the user's approval. Leave approving or requesting changes to the user.";
|
|
22769
|
+
var PR_REVIEW_REGEX = /gh pr review[^;&|]*? (?:-[bcaFr]\b|--(?:body|body-file|comment|approve|request-changes)\b)/;
|
|
22770
|
+
var GH_PULL_REVIEW_API_MESSAGE = "Do not write to pull request comments or reviews with 'gh api' \u2014 it bypasses the content validation and the approval pane. Use 'assist github issue comment <number> --body <body>' for a PR conversation comment (PR numbers are issue numbers), 'assist prs reply <comment-id> <body>' to reply in a review thread, or 'assist prs comment <path> <line> <body>' to add a line comment to the pending review. Each gates the text on the user's approval before anything reaches GitHub.";
|
|
22755
22771
|
var BRANCH_CREATION_REGEXES = [
|
|
22756
22772
|
/git (?:checkout|co) -[bB]/,
|
|
22757
22773
|
/git switch (?:-[cC]|--create)/,
|
|
@@ -22771,9 +22787,17 @@ var builtinDenyRules = [
|
|
|
22771
22787
|
message: CLOSE_WITH_COMMENT_MESSAGE,
|
|
22772
22788
|
matches: (text20) => CLOSE_WITH_COMMENT_REGEX.test(text20)
|
|
22773
22789
|
},
|
|
22790
|
+
{
|
|
22791
|
+
message: PR_REVIEW_MESSAGE,
|
|
22792
|
+
matches: (text20) => PR_REVIEW_REGEX.test(text20)
|
|
22793
|
+
},
|
|
22774
22794
|
{
|
|
22775
22795
|
message: GH_ISSUE_API_MESSAGE,
|
|
22776
22796
|
matches: isGhIssueApiWrite
|
|
22797
|
+
},
|
|
22798
|
+
{
|
|
22799
|
+
message: GH_PULL_REVIEW_API_MESSAGE,
|
|
22800
|
+
matches: isGhPullReviewApiWrite
|
|
22777
22801
|
}
|
|
22778
22802
|
];
|
|
22779
22803
|
|