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
|
|
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
|
-
|
|
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
|
-
|
|
8
|
+
## ✨ How it works
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
24
|
+
## 📦 Installation
|
|
24
25
|
|
|
25
|
-
###
|
|
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
|
|
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
|
-
|
|
32
|
+
Or install locally:
|
|
85
33
|
|
|
86
34
|
```bash
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
# Compile VS Code extension
|
|
91
|
-
cd vscode-ext && npm run compile
|
|
35
|
+
pi install pi-vscode-sr -l
|
|
36
|
+
```
|
|
92
37
|
|
|
93
|
-
|
|
94
|
-
cd vscode-ext && npm run watch
|
|
38
|
+
### 2. VS Code Extension
|
|
95
39
|
|
|
96
|
-
|
|
97
|
-
cd vscode-ext && npm run package
|
|
98
|
-
```
|
|
40
|
+
Install from marketplace:
|
|
99
41
|
|
|
100
|
-
|
|
42
|
+
**`serhioromano.vscode-pi-sr`** — Pi Agent Companion
|
|
101
43
|
|
|
102
|
-
|
|
44
|
+
Or search `Pi Companion` in the VS Code Extensions panel.
|
package/package.json
CHANGED
|
Binary file
|
package/vscode-ext/package.json
CHANGED
|
Binary file
|
|
Binary file
|
package/vscode-ext/icon.png
DELETED
|
Binary file
|