@celljs/ta-permission-gate 4.6.0 → 4.7.0
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.en.md +28 -0
- package/package.json +1 -1
package/README.en.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Cell - Ta Permission Gate
|
|
2
|
+
|
|
3
|
+
A pi package: allows, asks for permission on, or denies tool calls based on rules. No Cell dependency; both Ta and pi can install it:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
ta install npm:@celljs/ta-permission-gate
|
|
7
|
+
pi install npm:@celljs/ta-permission-gate
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Rules are written in `permissions.json`, with one global file (in the agent directory) and one per project (in `.ta/` or `.pi/`):
|
|
11
|
+
|
|
12
|
+
```json
|
|
13
|
+
{
|
|
14
|
+
"default": "allow",
|
|
15
|
+
"rules": [
|
|
16
|
+
{ "tool": "bash", "command": "git push*", "action": "ask" },
|
|
17
|
+
{ "tool": "bash", "command": "*rm -rf*", "action": "deny" },
|
|
18
|
+
{ "path": "*/.env*", "action": "deny" }
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
- The first matching rule in each file takes effect. If none match, use `default` (default is `allow`); `*` matches any characters, others are literal.
|
|
24
|
+
- Both files take the stricter result: a project can only tighten permissions, not loosen them; otherwise an untrusted repo could give itself permissions.
|
|
25
|
+
- `ask` calls `ctx.ui.confirm`. If no answer arrives within 5 minutes, it's treated as deny. Without a UI (`-p`) it's directly denied. Under `ta serve`, the dialog is sent to all connected clients.
|
|
26
|
+
- If a file cannot be read or has bad format, all calls are denied.
|
|
27
|
+
|
|
28
|
+
When there's no `permissions.json`, nothing is restricted, consistent with pi's default behavior.
|