@xynogen/pix-gate 0.1.12 → 0.1.13
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 +13 -7
- package/package.json +3 -2
- package/src/lib.ts +16 -10
package/README.md
CHANGED
|
@@ -35,18 +35,24 @@ rules as the bash tool (auto-deny on match, no prompt).
|
|
|
35
35
|
|
|
36
36
|
## Configuration
|
|
37
37
|
|
|
38
|
-
`~/.pi/agent/pix-gate.json
|
|
38
|
+
Gate rules are read from the **`gate` section of `~/.pi/agent/pix.json`** (the unified config file). The legacy `~/.pi/agent/pix-gate.json` file is no longer used.
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
`~/.pi/agent/pix.json` — `gate` section:
|
|
41
|
+
|
|
42
|
+
```jsonc
|
|
41
43
|
{
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
"gate": {
|
|
45
|
+
"disableDefaults": false,
|
|
46
|
+
"extraRules": [
|
|
47
|
+
{ "pattern": "rm -rf /my-dir", "severity": "critical", "reason": "Deletes project root" }
|
|
48
|
+
],
|
|
49
|
+
"autoApprove": ["^echo "]
|
|
50
|
+
}
|
|
47
51
|
}
|
|
48
52
|
```
|
|
49
53
|
|
|
54
|
+
The schema is identical to the old `pix-gate.json` — move your existing config into `pix.json` under the `gate` key.
|
|
55
|
+
|
|
50
56
|
## Full distro
|
|
51
57
|
|
|
52
58
|
Source: [github.com/xynogen/pix-mono](https://github.com/xynogen/pix-mono)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xynogen/pix-gate",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"description": "Pi extension — permission gate for dangerous bash commands (confirm/block with TUI dialog)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -42,7 +42,8 @@
|
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@xynogen/pix-pretty": "^1.7.9"
|
|
45
|
+
"@xynogen/pix-pretty": "^1.7.9",
|
|
46
|
+
"@xynogen/pix-data": "workspace:*"
|
|
46
47
|
},
|
|
47
48
|
"peerDependencies": {
|
|
48
49
|
"@earendil-works/pi-coding-agent": "*",
|
package/src/lib.ts
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
* Pure helpers for pix-gate — no Pi API deps, fully unit-testable.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import { homedir } from "node:os";
|
|
7
|
-
import { join } from "node:path";
|
|
5
|
+
import { type GateRuleConfig, pixConfig } from "@xynogen/pix-data/pix-config";
|
|
8
6
|
|
|
9
7
|
export type Severity = "critical" | "dangerous" | "risky";
|
|
10
8
|
|
|
@@ -132,13 +130,21 @@ export const DEFAULT_RULES: Rule[] = [
|
|
|
132
130
|
];
|
|
133
131
|
|
|
134
132
|
export function loadUserConfig(): UserConfig {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
133
|
+
// Read from ~/.pi/agent/pix.json gate section
|
|
134
|
+
const pix = pixConfig().gate;
|
|
135
|
+
return {
|
|
136
|
+
disableDefaults: pix.disableDefaults || undefined,
|
|
137
|
+
autoApprove: pix.autoApprove.length > 0 ? pix.autoApprove : undefined,
|
|
138
|
+
extraRules:
|
|
139
|
+
pix.extraRules.length > 0
|
|
140
|
+
? pix.extraRules.map((r: GateRuleConfig) => ({
|
|
141
|
+
pattern: r.pattern,
|
|
142
|
+
flags: r.flags,
|
|
143
|
+
severity: r.severity as Severity | undefined,
|
|
144
|
+
reason: r.reason,
|
|
145
|
+
}))
|
|
146
|
+
: undefined,
|
|
147
|
+
};
|
|
142
148
|
}
|
|
143
149
|
|
|
144
150
|
export function buildRules(cfg: UserConfig): {
|