@diegopetrucci/pi-extensions 0.1.53 → 0.1.55

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.
Files changed (76) hide show
  1. package/.pi-fleet-tested-version +1 -1
  2. package/README.md +37 -15
  3. package/extensions/agent-workflow-audit/.pi-fleet-tested-version +1 -1
  4. package/extensions/agent-workflow-audit/index.ts +12 -0
  5. package/extensions/agent-workflow-audit/package.json +1 -1
  6. package/extensions/annotate-git-diff/.pi-fleet-tested-version +1 -1
  7. package/extensions/annotate-git-diff/git.ts +1 -0
  8. package/extensions/annotate-git-diff/index.ts +1 -1
  9. package/extensions/annotate-git-diff/package.json +1 -1
  10. package/extensions/annotate-git-diff/prompt.ts +2 -1
  11. package/extensions/annotate-last-message/.pi-fleet-tested-version +1 -1
  12. package/extensions/annotate-last-message/index.ts +1 -1
  13. package/extensions/annotate-last-message/package.json +1 -1
  14. package/extensions/brrr/.pi-fleet-tested-version +1 -1
  15. package/extensions/brrr/index.ts +4 -3
  16. package/extensions/brrr/package.json +1 -1
  17. package/extensions/claude-fast/.pi-fleet-tested-version +1 -1
  18. package/extensions/claude-fast/package.json +1 -1
  19. package/extensions/code-reviewer/.pi-fleet-tested-version +1 -0
  20. package/extensions/code-reviewer/README.md +84 -0
  21. package/extensions/code-reviewer/index.ts +1280 -0
  22. package/extensions/code-reviewer/package.json +35 -0
  23. package/extensions/confirm-destructive/.pi-fleet-tested-version +1 -1
  24. package/extensions/confirm-destructive/package.json +1 -1
  25. package/extensions/context-cap/.pi-fleet-tested-version +1 -1
  26. package/extensions/context-cap/package.json +1 -1
  27. package/extensions/context-inspector/.pi-fleet-tested-version +1 -1
  28. package/extensions/context-inspector/index.ts +5 -0
  29. package/extensions/context-inspector/package.json +1 -1
  30. package/extensions/contrarian/.pi-fleet-tested-version +1 -1
  31. package/extensions/contrarian/index.ts +35 -3
  32. package/extensions/contrarian/package.json +1 -1
  33. package/extensions/dirty-repo-guard/.pi-fleet-tested-version +1 -1
  34. package/extensions/dirty-repo-guard/package.json +1 -1
  35. package/extensions/dynamic-context-pruning/.pi-fleet-tested-version +1 -0
  36. package/extensions/dynamic-context-pruning/README.md +435 -0
  37. package/extensions/dynamic-context-pruning/index.ts +2546 -0
  38. package/extensions/dynamic-context-pruning/package.json +34 -0
  39. package/extensions/git-footer/.pi-fleet-tested-version +1 -1
  40. package/extensions/git-footer/index.ts +42 -14
  41. package/extensions/git-footer/package.json +1 -1
  42. package/extensions/gnosis/.pi-fleet-tested-version +1 -1
  43. package/extensions/gnosis/package.json +1 -1
  44. package/extensions/illustrations-to-explain-things/.pi-fleet-tested-version +1 -1
  45. package/extensions/illustrations-to-explain-things/package.json +1 -1
  46. package/extensions/inline-bash/.pi-fleet-tested-version +1 -1
  47. package/extensions/inline-bash/package.json +1 -1
  48. package/extensions/librarian/.pi-fleet-tested-version +1 -1
  49. package/extensions/librarian/index.ts +7 -0
  50. package/extensions/librarian/package.json +1 -1
  51. package/extensions/minimal-footer/.pi-fleet-tested-version +1 -1
  52. package/extensions/minimal-footer/index.ts +132 -72
  53. package/extensions/minimal-footer/package.json +1 -1
  54. package/extensions/notify/.pi-fleet-tested-version +1 -1
  55. package/extensions/notify/package.json +1 -1
  56. package/extensions/openai-fast/.pi-fleet-tested-version +1 -1
  57. package/extensions/openai-fast/package.json +1 -1
  58. package/extensions/oracle/.pi-fleet-tested-version +1 -1
  59. package/extensions/oracle/index.ts +21 -2
  60. package/extensions/oracle/package.json +1 -1
  61. package/extensions/permission-gate/.pi-fleet-tested-version +1 -1
  62. package/extensions/permission-gate/index.ts +5 -1
  63. package/extensions/permission-gate/package.json +1 -1
  64. package/extensions/quiet-tools/.pi-fleet-tested-version +1 -1
  65. package/extensions/quiet-tools/index.ts +6 -0
  66. package/extensions/quiet-tools/package.json +1 -1
  67. package/extensions/review/.pi-fleet-tested-version +1 -1
  68. package/extensions/review/index.ts +251 -197
  69. package/extensions/review/package.json +1 -1
  70. package/extensions/todo/.pi-fleet-tested-version +1 -1
  71. package/extensions/todo/index.ts +1 -1
  72. package/extensions/todo/package.json +1 -1
  73. package/extensions/triage-comments/.pi-fleet-tested-version +1 -1
  74. package/extensions/triage-comments/index.ts +25 -3
  75. package/extensions/triage-comments/package.json +1 -1
  76. package/package.json +9 -6
@@ -1 +1 @@
1
- 0.79.10
1
+ 0.80.3
package/README.md CHANGED
@@ -2,32 +2,54 @@
2
2
 
3
3
  [![Total npm downloads](https://img.shields.io/npm/dt/%40diegopetrucci%2Fpi-extensions?label=total%20npm%20downloads)](https://www.npmjs.com/package/@diegopetrucci/pi-extensions)
4
4
 
5
- A collection of [pi](https://github.com/earendil-works/pi-mono) agent extensions and skills I made.
5
+ A collection of [pi](https://pi.dev) agent extensions I made. (btw, [I am also building my own harness on top of pi](https://github.com/diegopetrucci/the-last-harness). have a look!)
6
+
7
+ ### Subagents
8
+
9
+ - [`code-reviewer`](./extensions/code-reviewer): Adds a read-only `code_reviewer` subagent tool that reviews local changes for ticket fit, diff mismatches, correctness, security, simplicity, and validation gaps without implementing fixes, auto-selects a contrarian-style opposite-provider review model when available, and clamps requested thinking to the chosen model's capabilities.
10
+ - [`contrarian`](./extensions/contrarian): Adds a read-only contrarian tool that spins up an isolated subprocess to stress-test plans, designs, assumptions, bug hypotheses, and conclusions by steelmanning the strongest opposing case.
11
+ - [`librarian`](./extensions/librarian): Adds a GitHub research scout with a local repo checkout cache disabled by default under the OS user cache directory, toggleable with `/librarian-cache`, configurable subagent model/thinking defaults via `/librarian-config`, and cached repos expiring after 7 days of non-use.
12
+ - [`oracle`](./extensions/oracle): Adds an Amp-style read-only oracle tool that auto-selects the strongest reasoning model on the current provider/subscription, supports persisted `/oracle` model/thinking defaults, requests xhigh reasoning by default and clamps to model capabilities, and shows live status while running.
13
+
14
+ ### Providers
15
+
16
+ - [`claude-fast`](./extensions/claude-fast): Adds `/claude-fast` to enable Anthropic Claude Fast mode for supported Claude Opus models by injecting `speed: "fast"`.
17
+ - [`openai-fast`](./extensions/openai-fast): Adds `/fast` to enable OpenAI Codex Fast mode for ChatGPT-auth GPT-5.4 and GPT-5.5 by injecting the priority service tier.
18
+
19
+ ### UI
20
+
21
+ - [`git-footer`](./extensions/git-footer): Standalone extension that adds TLH-style git dirty counts, ahead/behind, and optional PR number to pi's built-in footer status area.
22
+ - [`minimal-footer`](./extensions/minimal-footer): Replaces pi's built-in footer with a minimal configurable two-line layout: branch plus cached git dirty/ahead/PR status and repo on the first line, context/model on the second, optional `DUMB ZONE`, optional `xp` marker, plus OpenAI Codex 5-hour and 7-day usage when available.
23
+ - [`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`.
24
+
25
+ ### / Slash commands
6
26
 
7
27
  - [`agent-workflow-audit`](./extensions/agent-workflow-audit): Adds `/agent-workflow-audit`, which runs an isolated repo workflow audit subagent and returns only the final distilled report to the main session.
8
28
  - [`annotate-git-diff`](./extensions/annotate-git-diff): Adds `/annotate-git-diff`, a native Glimpse UI for annotating git diffs and appending structured feedback prompts to the editor.
9
29
  - [`annotate-last-message`](./extensions/annotate-last-message): Adds `/annotate-last-message`, a native Glimpse UI for annotating the latest assistant reply and sending planning-oriented feedback back through the editor.
10
- - [`brrr`](./extensions/brrr): Sends brrr push notifications when pi finishes an agent turn and is ready for input, with optional macOS idle gating.
11
- - [`claude-fast`](./extensions/claude-fast): Adds `/claude-fast` to enable Anthropic Claude Fast mode for supported Claude Opus models by injecting `speed: "fast"`.
12
- - [`confirm-destructive`](./extensions/confirm-destructive): Confirms before destructive session actions like clear, switch, and fork.
13
- - [`contrarian`](./extensions/contrarian): Adds a read-only contrarian tool that spins up an isolated subprocess to stress-test plans, designs, assumptions, bug hypotheses, and conclusions by steelmanning the strongest opposing case.
30
+ - [`review`](./extensions/review): Adds `/review` and `/end-review` for interactive code reviews of local changes, commits, PRs, and selected paths.
31
+ - [`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
32
+
33
+ ### Context management
34
+
14
35
  - [`context-cap`](./extensions/context-cap): Caps effective model context windows at 200k tokens by default so pi avoids the `dumb zone`; toggle temporarily with `/context-cap`.
15
36
  - [`context-inspector`](./extensions/context-inspector): Adds `/context`, a local self-contained HTML dashboard that breaks down where the current session context is going, with category overview, top offenders, and drilldown search.
37
+ - [`dynamic-context-pruning`](./extensions/dynamic-context-pruning): Automatically prunes duplicate tool results, stale errored inputs, and superseded file-op outputs from long sessions behind a cache-aware net-benefit gate, with a `/prune` picker and `/context-pruning` status/control commands.
38
+
39
+ ### Safety
40
+
41
+ - [`confirm-destructive`](./extensions/confirm-destructive): Confirms before destructive session actions like clear, switch, and fork.
16
42
  - [`dirty-repo-guard`](./extensions/dirty-repo-guard): Prompts before new sessions, session switches, or forks when the current git repo has uncommitted changes.
17
- - [`git-footer`](./extensions/git-footer): Standalone extension that adds TLH-style git dirty counts, ahead/behind, and optional PR number to pi's built-in footer status area.
43
+ - [`permission-gate`](./extensions/permission-gate): Prompts for confirmation before dangerous bash commands like `rm -rf`, `sudo`, and `chmod 777`.
44
+
45
+ ### Quality of life
46
+
47
+ - [`brrr`](./extensions/brrr): Sends brrr push notifications when pi finishes an agent turn and is ready for input, with optional macOS idle gating.
18
48
  - [`gnosis`](./extensions/gnosis): Exposes the `gn` repo-local knowledge base CLI as an agent tool for searching and recording durable project decisions, constraints, and intent.
19
49
  - [`illustrations-to-explain-things`](./extensions/illustrations-to-explain-things): Adds a skill for generating clean, absurd Xiaohei-style article illustrations, shot lists, image edits, and visual metaphors.
20
50
  - [`inline-bash`](./extensions/inline-bash): Expands `!{command}` snippets in user prompts by running them through bash before the prompt reaches the agent.
21
- - [`librarian`](./extensions/librarian): Adds a GitHub research scout with a local repo checkout cache disabled by default under the OS user cache directory, toggleable with `/librarian-cache`, configurable subagent model/thinking defaults via `/librarian-config`, and cached repos expiring after 7 days of non-use.
22
- - [`minimal-footer`](./extensions/minimal-footer): Replaces pi's built-in footer with a minimal configurable two-line layout: branch plus cached git dirty/ahead/PR status and repo on the first line, context/model on the second, optional `DUMB ZONE`, optional `xp` marker, plus OpenAI Codex 5-hour and 7-day usage when available.
23
51
  - [`notify`](./extensions/notify): Sends configurable terminal, desktop, bell, and sound notifications when pi finishes and is ready for input.
24
- - [`openai-fast`](./extensions/openai-fast): Adds `/fast` to enable OpenAI Codex Fast mode for ChatGPT-auth GPT-5.4 and GPT-5.5 by injecting the priority service tier.
25
- - [`oracle`](./extensions/oracle): Adds an Amp-style read-only oracle tool that auto-selects the strongest reasoning model on the current provider/subscription, supports persisted `/oracle` model/thinking defaults, requests xhigh reasoning by default and clamps to model capabilities, and shows live status while running.
26
- - [`permission-gate`](./extensions/permission-gate): Prompts for confirmation before dangerous bash commands like `rm -rf`, `sudo`, and `chmod 777`.
27
- - [`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`.
28
- - [`review`](./extensions/review): Adds `/review` and `/end-review` for interactive code reviews of local changes, commits, PRs, and selected paths.
29
- - [`todo`](./extensions/todo): Adds a branch-aware `todo` tool for the agent and a `/todos` viewer for users.
30
- - [`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.
52
+ - [`todo`](./extensions/todo): Adds a branch-aware `todo` tool for the agent and a `/todos` viewer for users..
31
53
 
32
54
  (For the full list of pi extensions I use, [check out my dotfiles](https://github.com/diegopetrucci/dot/blob/main/.pi/agent/settings.json).)
33
55
 
@@ -1 +1 @@
1
- 0.79.10
1
+ 0.80.3
@@ -1103,6 +1103,18 @@ async function runAudit(
1103
1103
  }
1104
1104
  }
1105
1105
 
1106
+ export const __test__ = {
1107
+ appendRunBoundary,
1108
+ assertToolPathInsideCwd,
1109
+ buildSystemPrompt,
1110
+ buildUserPrompt,
1111
+ createAuditRuntimeGuardExtension,
1112
+ formatToolCall,
1113
+ getBlockedBashReason,
1114
+ parseArgs,
1115
+ renderCollapsedReport,
1116
+ };
1117
+
1106
1118
  export default function agentWorkflowAuditExtension(pi: ExtensionAPI) {
1107
1119
  pi.registerMessageRenderer(CUSTOM_TYPE, (message, { expanded }, theme) => {
1108
1120
  const details = message.details as AuditDetails | undefined;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegopetrucci/pi-agent-workflow-audit",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "A pi extension that runs an isolated repo workflow audit and returns only the final report to the main session.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -1 +1 @@
1
- 0.79.10
1
+ 0.80.3
@@ -938,6 +938,7 @@ export async function loadReviewFileContents(
938
938
  }
939
939
 
940
940
  export const __testing = {
941
+ parseNameStatus,
941
942
  parseStatusPorcelainZ,
942
943
  shouldNormalizeBranchChanges,
943
944
  };
@@ -94,7 +94,7 @@ export default function (pi: ExtensionAPI) {
94
94
  }
95
95
 
96
96
  async function reviewRepository(ctx: ExtensionCommandContext): Promise<void> {
97
- if (!ctx.hasUI) {
97
+ if (ctx.mode !== "tui") {
98
98
  ctx.ui.notify("annotate-git-diff requires interactive mode.", "error");
99
99
  return;
100
100
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegopetrucci/pi-annotate-git-diff",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "A standalone pi extension that adds /annotate-git-diff, a native Glimpse UI for annotating git diffs and sending feedback to the editor.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -43,6 +43,7 @@ function formatLocation(comment: DiffReviewComment, file: ReviewFile | undefined
43
43
 
44
44
  export function composeReviewPrompt(files: ReviewFile[], payload: ReviewSubmitPayload): string {
45
45
  const fileMap = new Map(files.map((file) => [file.id, file]));
46
+ const comments = payload.comments.filter((comment) => comment.body.trim().length > 0);
46
47
  const lines: string[] = [];
47
48
 
48
49
  lines.push("Please address the following feedback");
@@ -54,7 +55,7 @@ export function composeReviewPrompt(files: ReviewFile[], payload: ReviewSubmitPa
54
55
  lines.push("");
55
56
  }
56
57
 
57
- payload.comments.forEach((comment, index) => {
58
+ comments.forEach((comment, index) => {
58
59
  const file = fileMap.get(comment.fileId);
59
60
  lines.push(`${index + 1}. ${formatLocation(comment, file)}`);
60
61
  lines.push(` ${comment.body.trim()}`);
@@ -1 +1 @@
1
- 0.79.10
1
+ 0.80.3
@@ -38,7 +38,7 @@ export function registerAnnotateLastMessageCommand(pi: ExtensionAPI): void {
38
38
  }
39
39
 
40
40
  async function openAnnotationWindow(ctx: ExtensionCommandContext): Promise<void> {
41
- if (!ctx.hasUI) {
41
+ if (ctx.mode !== "tui") {
42
42
  ctx.ui.notify("annotate-last-message requires interactive mode.", "error");
43
43
  return;
44
44
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegopetrucci/pi-annotate-last-message",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "A standalone pi extension that adds /annotate-last-message, a native Glimpse UI for annotating the latest assistant reply.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -1 +1 @@
1
- 0.79.10
1
+ 0.80.3
@@ -159,8 +159,9 @@ function extractTextContent(content: unknown): string {
159
159
  }
160
160
  if (typeof part !== "object" || part === null) continue;
161
161
 
162
- const maybeText = (part as { text?: unknown }).text;
163
- if (typeof maybeText === "string") parts.push(maybeText);
162
+ const typedPart = part as { type?: unknown; text?: unknown };
163
+ if (typedPart.type !== undefined && typedPart.type !== "text") continue;
164
+ if (typeof typedPart.text === "string") parts.push(typedPart.text);
164
165
  }
165
166
 
166
167
  return parts.join("\n");
@@ -173,7 +174,7 @@ function lastAssistantMessage(messages: readonly unknown[]): string | undefined
173
174
  if ((message as { role?: unknown }).role !== "assistant") continue;
174
175
 
175
176
  const text = extractTextContent((message as { content?: unknown }).content).trim();
176
- if (text) return text;
177
+ return text || undefined;
177
178
  }
178
179
 
179
180
  return undefined;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegopetrucci/pi-brrr",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "A pi extension that sends brrr push notifications when pi is ready for input.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -1 +1 @@
1
- 0.79.10
1
+ 0.80.3
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegopetrucci/pi-claude-fast",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "A pi extension that enables Anthropic Claude Fast mode for supported Claude Opus models by injecting speed=fast.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -0,0 +1,84 @@
1
+ # code-reviewer
2
+
3
+ Adds a read-only `code_reviewer` subagent tool that adapts The Last Harness [`code-reviewer`](https://github.com/diegopetrucci/the-last-harness/blob/main/agents/subagents/code-reviewer.md) prompt into a standalone pi extension.
4
+
5
+ Use it when you want an isolated second-pass review of a proposed change against the local checkout. The tool stays read-only, checks ticket fit and scope first, then looks for diff mismatches, correctness bugs, security/safety issues, unnecessary complexity, and missing validation.
6
+
7
+ This package is adapted from the TLH code-reviewer workflow for use as a standalone pi extension.
8
+
9
+ ## Install
10
+
11
+ ### Standalone npm package
12
+
13
+ ```bash
14
+ pi install npm:@diegopetrucci/pi-code-reviewer
15
+ ```
16
+
17
+ ### Collection package
18
+
19
+ ```bash
20
+ pi install npm:@diegopetrucci/pi-extensions
21
+ ```
22
+
23
+ ### GitHub package
24
+
25
+ ```bash
26
+ pi install git:github.com/diegopetrucci/pi-extensions
27
+ ```
28
+
29
+ Then reload pi:
30
+
31
+ ```text
32
+ /reload
33
+ ```
34
+
35
+ ## `code_reviewer` tool behavior
36
+
37
+ The tool accepts:
38
+
39
+ - `task` — required review target and success criteria
40
+ - `diff` — optional diff, patch, or change summary
41
+ - `context` — optional extra constraints or known risks
42
+
43
+ When called, it launches an isolated in-memory child agent with:
44
+
45
+ - no inherited extensions, skills, prompt templates, themes, context files, or agents files;
46
+ - an auto-selected review model that prefers contrarian-style opposite-provider and opposite-family candidates before same-provider fallbacks;
47
+ - requested thinking taken from the active session when available, otherwise defaulting to `high` for reasoning models and `off` for non-reasoning models, then clamped to the selected model's supported level;
48
+ - read-only tools only: `read`, `grep`, `find`, `ls`, and guarded `bash`;
49
+ - a local-checkout path guard for file inspection;
50
+ - a bash guard that allows only direct read-only `git`, `gh`, or `pwd` invocations.
51
+
52
+ The review prompt prioritizes:
53
+
54
+ 1. ticket fit and scope
55
+ 2. diff accuracy
56
+ 3. correctness and regressions
57
+ 4. security and safety
58
+ 5. simplicity and maintainability
59
+ 6. tests and validation gaps
60
+
61
+ The final output is concise and includes a verdict, findings, validation notes, a scope check, and run details that show the final selected model and effective thinking level.
62
+
63
+ ## Read-only guarantees
64
+
65
+ - The subagent is explicitly instructed not to implement changes.
66
+ - Runtime guards block write/edit tools, shell control operators, pipelines, redirection, path traversal outside the checkout, mutating `git`/`gh` commands, `npm`/publish commands, and other filesystem mutation.
67
+ - Built-in file-inspection tools are preferred over shell commands for local files.
68
+
69
+ ## Example
70
+
71
+ ```text
72
+ Use code_reviewer on this task before merging:
73
+
74
+ {
75
+ "task": "Review ticket pe-7lpt implementation for scope fit and correctness.",
76
+ "context": "Focus on whether the new extension stays runtime-only and keeps tools read-only."
77
+ }
78
+ ```
79
+
80
+ ## Limitations
81
+
82
+ - The subagent has an 8-turn and 8-minute budget.
83
+ - The review quality depends on the local checkout matching the change being reviewed.
84
+ - `gh`-based inspection is available only when GitHub CLI is installed and authenticated, but the tool can still review local changes without it.