@diegopetrucci/pi-review 0.1.2 → 0.1.4

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.
@@ -1 +1 @@
1
- 0.78.0
1
+ 0.79.10
package/README.md CHANGED
@@ -31,7 +31,7 @@ Then reload pi:
31
31
 
32
32
  - Behavior is intentionally kept equivalent to the upstream source, with only packaging/attribution changes for this repository.
33
33
  - PR review requires `gh` access and a clean working tree for tracked files.
34
- - If a `REVIEW_GUIDELINES.md` file exists next to the repo's `.pi` directory, its contents are appended to the review prompt.
34
+ - If the project is trusted and a `REVIEW_GUIDELINES.md` file exists next to the repo's `.pi` directory, its contents are appended to the review prompt.
35
35
 
36
36
  ## License and attribution
37
37
 
package/index.ts CHANGED
@@ -29,8 +29,8 @@
29
29
  * - `/review --extra "focus on performance regressions"` - add extra review instruction (works with any mode)
30
30
  *
31
31
  * Project-specific review guidelines:
32
- * - If a REVIEW_GUIDELINES.md file exists in the same directory as .pi,
33
- * its contents are appended to the review prompt.
32
+ * - If the project is trusted and a REVIEW_GUIDELINES.md file exists in the
33
+ * same directory as .pi, its contents are appended to the review prompt.
34
34
  *
35
35
  * Note: PR review requires a clean working tree (no uncommitted changes to tracked files).
36
36
  */
@@ -49,6 +49,8 @@ import {
49
49
  import path from "node:path";
50
50
  import { promises as fs } from "node:fs";
51
51
 
52
+ const CONFIG_DIR_NAME = ".pi";
53
+
52
54
  // State to track fresh session review (where we branched from).
53
55
  // Module-level state means only one review can be active at a time.
54
56
  // This is intentional - the UI and /end-review command assume a single active review.
@@ -75,6 +77,15 @@ type ReviewSettingsState = {
75
77
  customInstructions?: string;
76
78
  };
77
79
 
80
+ type ProjectConfigContext = {
81
+ cwd: string;
82
+ isProjectTrusted?: () => boolean;
83
+ };
84
+
85
+ function canReadProjectConfig(ctx: ProjectConfigContext): boolean {
86
+ return typeof ctx.isProjectTrusted === "function" && ctx.isProjectTrusted();
87
+ }
88
+
78
89
  function setReviewWidget(ctx: ExtensionContext, active: boolean) {
79
90
  if (!ctx.hasUI) return;
80
91
  if (!active) {
@@ -501,7 +512,7 @@ async function loadProjectReviewGuidelines(cwd: string): Promise<string | null>
501
512
  let currentDir = path.resolve(cwd);
502
513
 
503
514
  while (true) {
504
- const piDir = path.join(currentDir, ".pi");
515
+ const piDir = path.join(currentDir, CONFIG_DIR_NAME);
505
516
  const guidelinesPath = path.join(currentDir, "REVIEW_GUIDELINES.md");
506
517
 
507
518
  const piStats = await fs.stat(piDir).catch(() => null);
@@ -1420,7 +1431,7 @@ export default function reviewExtension(pi: ExtensionAPI) {
1420
1431
  includeLocalChanges: options?.includeLocalChanges === true,
1421
1432
  });
1422
1433
  const hint = getUserFacingHint(target);
1423
- const projectGuidelines = await loadProjectReviewGuidelines(ctx.cwd);
1434
+ const projectGuidelines = canReadProjectConfig(ctx) ? await loadProjectReviewGuidelines(ctx.cwd) : null;
1424
1435
 
1425
1436
  // Combine the review rubric with the specific prompt
1426
1437
  let fullPrompt = `${REVIEW_RUBRIC}\n\n---\n\nPlease perform a code review with the following focus:\n\n${prompt}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegopetrucci/pi-review",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "A standalone pi extension that adds /review and /end-review commands adapted from mitsuhiko/agent-stuff.",
5
5
  "keywords": [
6
6
  "pi-package",