@diegopetrucci/pi-extensions 0.1.25 → 0.1.27

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 CHANGED
@@ -15,8 +15,7 @@ A collection of [pi](https://github.com/earendil-works/pi-mono) agent extensions
15
15
  - [`permission-gate`](./extensions/permission-gate): Prompts for confirmation before dangerous bash commands like `rm -rf`, `sudo`, and `chmod 777`.
16
16
  - [`quiet-tools`](./extensions/quiet-tools): Renders collapsed built-in tool rows as a one-line invocation plus an expand hint without changing model-visible tool results; toggle temporarily with `/quiet-tools`.
17
17
  - [`todo`](./extensions/todo): Adds a branch-aware `todo` tool for the agent and a `/todos` viewer for users.
18
-
19
- > Security note: the full collection includes `inline-bash`, which executes `!{...}` snippets from prompt text through your local shell before the agent sees them. Treat pasted prompts as shell code; `permission-gate` does not intercept these user-prompt expansions.
18
+ - [`triage-comments`](./extensions/triage-comments): Adds `/triage-comments` and a read-only `triage_comments` subagent tool that can auto-detect the current branch's PR, filter resolved/outdated inline comments, classify selected review comments with evidence, and suggest handling options without implementing changes.
20
19
 
21
20
  (For the full list of pi extensions I use, [check out my dotfiles](https://github.com/diegopetrucci/dot/blob/main/.pi/agent/settings.json).)
22
21
 
@@ -28,12 +27,6 @@ Full collection:
28
27
  pi install npm:@diegopetrucci/pi-extensions
29
28
  ```
30
29
 
31
- Or pin the GitHub package to this release:
32
-
33
- ```bash
34
- pi install git:github.com/diegopetrucci/pi-extensions@v0.1.25
35
- ```
36
-
37
30
  Or a specific extension:
38
31
 
39
32
  ```bash
@@ -0,0 +1,139 @@
1
+ # triage-comments
2
+
3
+ Adds `/triage-comments` plus a read-only `triage_comments` subagent tool for evidence-based review-comment triage.
4
+
5
+ Use it when you want The Last Harness to inspect selected PR feedback, classify whether each comment is valid, cite local evidence, draft review-thread responses, and propose handling options. It does **not** implement changes; after triage, the main agent should ask which handling option to take before editing anything.
6
+
7
+ ## Install
8
+
9
+ ### Standalone npm package
10
+
11
+ ```bash
12
+ pi install npm:@diegopetrucci/pi-triage-comments
13
+ ```
14
+
15
+ ### Collection package
16
+
17
+ ```bash
18
+ pi install npm:@diegopetrucci/pi-extensions
19
+ ```
20
+
21
+ ### GitHub package
22
+
23
+ ```bash
24
+ pi install git:github.com/diegopetrucci/pi-extensions
25
+ ```
26
+
27
+ Then reload pi:
28
+
29
+ ```text
30
+ /reload
31
+ ```
32
+
33
+ ## Slash command flow
34
+
35
+ The extension registers `/triage-comments` as an interactive intake flow.
36
+
37
+ ```text
38
+ /triage-comments
39
+ /triage-comments paste
40
+ /triage-comments pr
41
+ /triage-comments pr 123
42
+ /triage-comments pr https://github.com/owner/repo/pull/123
43
+ /triage-comments 123
44
+ ```
45
+
46
+ - With no arguments, The Last Harness asks whether to paste feedback or fetch PR comments.
47
+ - `paste` opens an editor for multiline reviewer feedback, then sends one selected feedback item to the main agent.
48
+ - `pr` with no explicit target first tries to detect an existing PR for the current named non-`main` git branch using read-only `git` and `gh pr view` calls. If the branch is `main`, detached, outside a git repository, `gh` is unavailable or unauthenticated, or no PR is found, it falls back to the PR URL/number prompt.
49
+ - `pr <PR URL or number>` and a bare PR URL/number fetch that explicit PR directly, display PR review comments, PR issue comments, and review bodies with `gh` as numbered items with stable IDs, and ask whether to investigate all displayed comments or an explicit subset such as `1,3-5`.
50
+ - Before displaying fetched PR comments, PR mode asks whether to show all comments or hide resolved inline review comments, outdated inline review comments, or both. This filter applies only to inline review comments because GitHub exposes resolved/outdated state at the review-thread level; PR issue comments and review bodies always remain visible, and inline comments without thread metadata remain visible.
51
+ - If more than 50 comments are displayed after filtering, you must choose a subset of at most 50 comments.
52
+ - The command sends a normal user message instructing the main agent to call `triage_comments` with the selected payload. It does not directly edit files or post GitHub replies.
53
+
54
+ The slash command requires interactive UI mode for the editor, PR comment display, and all/subset confirmation. In non-UI modes it prints usage instead of running the intake flow.
55
+
56
+ ## GitHub CLI requirements
57
+
58
+ PR mode requires:
59
+
60
+ - running inside a git checkout;
61
+ - GitHub CLI `gh` installed and on `PATH`;
62
+ - `gh auth login` completed for the target host/repository, including private repositories;
63
+ - a PR number that `gh pr view` can resolve from the current checkout, a full GitHub PR URL, or a current non-`main` branch with an existing PR that `gh pr view` can resolve.
64
+
65
+ The command uses read-only `git`/`gh` calls to detect the current branch PR when no target is supplied, then read-only `gh` calls to fetch PR metadata, review comments, PR issue comments, review bodies, and best-effort review-thread resolved/outdated metadata. It does not post comments, submit reviews, checkout branches, or mutate GitHub.
66
+
67
+ ## `triage_comments` tool behavior
68
+
69
+ The tool accepts selected comments and optional PR, base, diff, and caller context. Comment entries can be plain strings or objects with fields such as `body`, `path`, `line`, `startLine`, `side`, `diffHunk`, `author`, `url`, `createdAt`, and `metadata`.
70
+
71
+ When called, it launches an isolated in-memory subagent with:
72
+
73
+ - no inherited extensions, skills, prompt templates, themes, context files, or agents files;
74
+ - read-only tools only: `read`, `grep`, `find`, `ls`, and guarded `bash`;
75
+ - a local-checkout path guard for file inspection;
76
+ - a bash guard that allows only direct read-only `git`, `gh`, or `pwd` invocations and blocks write/edit tools, shell pipelines, redirection, destructive git commands, and mutating `gh`/GitHub API calls;
77
+ - a fixed triage output format with verdicts, evidence, reasoning, suggested responses, handling options, and a list of read-only checks performed.
78
+
79
+ Verdicts are one of `valid`, `invalid`, `partially valid`, `subjective`, or `needs clarification`.
80
+
81
+ ## Read-only and approval guarantees
82
+
83
+ - The slash command only collects/selects comments and asks the main agent to run triage.
84
+ - The subagent is explicitly instructed not to implement changes.
85
+ - Runtime guards block write tools, filesystem mutation through shell syntax, mutating git commands, and mutating GitHub CLI/API calls.
86
+ - The generated prompt tells the main agent to summarize findings and ask which handling option to take before implementation.
87
+ - Suggested responses are drafts for the user/agent to adapt; the extension does not post them to GitHub.
88
+
89
+ ## Examples
90
+
91
+ Paste a reviewer note:
92
+
93
+ ```text
94
+ /triage-comments paste
95
+ ```
96
+
97
+ Fetch a PR, inspect comments 1 and 3 through 5, then triage only that subset:
98
+
99
+ ```text
100
+ /triage-comments pr https://github.com/owner/repo/pull/123
101
+ # selection prompt: 1,3-5
102
+ ```
103
+
104
+ Ask the agent to use the tool directly:
105
+
106
+ ```text
107
+ Use triage_comments on this review comment and do not implement anything yet:
108
+
109
+ {
110
+ "comments": [
111
+ {
112
+ "body": "This helper appears to ignore the configured timeout.",
113
+ "path": "src/client.ts",
114
+ "line": 42,
115
+ "url": "https://github.com/owner/repo/pull/123#discussion_r123"
116
+ }
117
+ ],
118
+ "pr": {
119
+ "number": 123,
120
+ "repository": "owner/repo"
121
+ },
122
+ "context": "Classify the comment and suggest response options only."
123
+ }
124
+ ```
125
+
126
+ Typical output includes a summary, per-comment verdicts with citations, a suggested reply, handling options, and the reminder:
127
+
128
+ ```text
129
+ Do not implement changes from this triage automatically; ask the parent/user which option to take before implementation.
130
+ ```
131
+
132
+ ## Limitations
133
+
134
+ - At most 50 comments can be triaged in one tool call.
135
+ - The subagent has an 8-turn and 8-minute budget.
136
+ - PR mode depends on the GitHub API data available to `gh`; authentication, permissions, host configuration, and API availability can affect what is fetched.
137
+ - Resolved/outdated filtering is best effort and only applies to inline review comments. If GitHub does not return review-thread metadata for an inline comment, `/triage-comments` keeps it visible and labels the thread state as unavailable.
138
+ - The tool validates against the current local checkout. If the checkout does not match the PR head/base or supplied diff context, the result may be `needs clarification` or call out stale/missing evidence.
139
+ - Paste mode treats the editor contents as one feedback item; use PR mode or direct tool calls for multiple separately numbered comments.