pi-vscode-sr 1.1.1 → 1.1.3

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
@@ -1,102 +1,44 @@
1
- # Pi VS Code
1
+ # 🔍 Pi VS Code
2
2
 
3
- Pi extension that integrates with VS Code's diff editor for reviewing code changes proposed by the Pi agent.
3
+ Secure code review bridge between **Pi coding agent** and **VS Code**. Every file mutation proposed by Pi opens a diff editor you preview, edit, and approve or reject before anything touches disk.
4
4
 
5
- ## Architecture
5
+ <img width="800" alt="Pi Defender" src="https://raw.githubusercontent.com/Serhioromano/pi-vscode/refs/heads/master/images/pi-vscode.png">
6
6
 
7
- The project has **two components** in one repository:
8
7
 
9
- ### 1. Pi Extension (root)
8
+ ## How it works
10
9
 
11
- - **`src/index.ts`** Extension loaded by Pi agent (`@earendil-works/pi-tui`)
12
- - Published as npm package `pi-vscode-sr`
13
- - **Overrides `write` tool** instead of writing directly, creates a review request in `.pi/review-requests/{uuid}.json`
14
- - Polls `.pi/review-results/{uuid}.json` for user's decision, then writes if approved
10
+ 1. Pi agent generates code changes
11
+ 2. Instead of writing directly, a **review request** is created
12
+ 3. VS Code opens a **diff editor** so you can inspect and even edit the proposed changes
13
+ 4. Choose what to do in a terminal selector:
15
14
 
16
- ### 2. VS Code Extension (`vscode-ext/`) — **Pi Companion**
15
+ | Option | Action |
16
+ |--------|--------|
17
+ | ✅ **Approve** | Apply this file's changes |
18
+ | ❌ **Reject** | Discard this file's changes — agent sees an error and must retry |
19
+ | ⭐ **Approve All** | Auto-approve every future change for this session |
20
+ | 🚪 **Abort** | Stop the agent session immediately |
17
21
 
18
- - **`vscode-ext/src/extension.ts`** VS Code extension (package name: `vscode-pi-sr`) with approve/reject buttons in diff editor
19
- - Watches `.pi/review-requests/` for new review requests from Pi
20
- - Opens diff editors with **✓ Approve / ✗ Reject** buttons in the editor title bar
21
- - Writes results to `.pi/review-results/` for Pi to read
22
+ You can also approve/reject from the diff tab.
22
23
 
23
- ## Protocol
24
+ ## 📦 Installation
24
25
 
25
- ### Review Request (Pi → VS Code Extension)
26
+ ### 1. Pi Extension
26
27
 
27
- File: `.pi/review-requests/{uuid}.json`
28
-
29
- ```json
30
- {
31
- "id": "550e8400-e29b-41d4-a716-446655440000",
32
- "title": "Add input validation to login",
33
- "files": [
34
- {
35
- "path": "src/auth/login.ts",
36
- "original": "export function login(email: string, password: string) {\n return api.post('/login', { email, password });\n}",
37
- "proposed": "export function login(email: string, password: string) {\n if (!email.includes('@')) throw new Error('Invalid email');\n if (password.length < 8) throw new Error('Password too short');\n return api.post('/login', { email, password });\n}",
38
- "description": "Added email and password validation",
39
- "language": "typescript"
40
- }
41
- ]
42
- }
43
- ```
44
-
45
- ### Review Result (VS Code Extension → Pi)
46
-
47
- File: `.pi/review-results/{uuid}.json`
48
-
49
- ```json
50
- {
51
- "id": "550e8400-e29b-41d4-a716-446655440000",
52
- "status": "approved",
53
- "files": [
54
- {
55
- "path": "src/auth/login.ts",
56
- "status": "approved",
57
- "final": "export function login(email: string, password: string) {\n if (!email.includes('@')) throw new Error('Invalid email');\n if (password.length < 8) throw new Error('Password too short');\n return api.post('/login', { email, password });\n}"
58
- }
59
- ]
60
- }
61
- ```
62
-
63
- ## Quick Start
64
-
65
- ### VS Code Extension Dev
66
- 1. Open this project in VS Code
67
- 2. Press **F5** (or run "Run VS Code Extension" in Run & Debug)
68
- 3. A new VS Code window opens with the extension loaded
69
- 4. In that window, create a test request:
70
- ```bash
71
- mkdir -p .pi/review-requests
72
- cp /home/sergey/www/pi-vscode/.pi/review-requests/test.json .pi/review-requests/
73
- ```
74
- 5. The extension will open a diff editor with **✓ Approve / ✗ Reject** buttons
75
- 6. Edit the right side, then click Approve or Reject
76
-
77
- ### Pi Extension (npm)
78
- Run Pi with the extension:
79
28
  ```bash
80
- pi -e /path/to/pi-vscode/src/index.ts
29
+ pi install pi-vscode-sr
81
30
  ```
82
- When Pi calls `write`, the extension creates a review request instead of writing directly.
83
31
 
84
- ## Development
32
+ Or install locally:
85
33
 
86
34
  ```bash
87
- # Compile Pi extension (root)
88
- npm run compile
89
-
90
- # Compile VS Code extension
91
- cd vscode-ext && npm run compile
35
+ pi install pi-vscode-sr -l
36
+ ```
92
37
 
93
- # Watch mode (VS Code extension)
94
- cd vscode-ext && npm run watch
38
+ ### 2. VS Code Extension
95
39
 
96
- # Package VS Code extension as .vsix
97
- cd vscode-ext && npm run package
98
- ```
40
+ Install from marketplace:
99
41
 
100
- ## License
42
+ **`serhioromano.vscode-pi-sr`** — Pi Agent Companion
101
43
 
102
- MIT
44
+ Or search `Pi Companion` in the VS Code Extensions panel.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-vscode-sr",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "Code diff assistant for VS Code.",
5
5
  "license": "MIT",
6
6
  "author": "Serhioromano",
Binary file
@@ -2,7 +2,7 @@
2
2
  "name": "vscode-pi-sr",
3
3
  "displayName": "Pi Agent Companion",
4
4
  "description": "Review and approve file changes proposed by Pi agent",
5
- "version": "1.1.0",
5
+ "version": "1.1.2",
6
6
  "publisher": "Serhioromano",
7
7
  "icon": "icon.png",
8
8
  "license": "MIT",
Binary file