@xynogen/pix-gate 0.2.2 → 0.2.6

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
@@ -4,7 +4,7 @@ Pi extension — permission gate for dangerous bash commands.
4
4
 
5
5
  ## What it does
6
6
 
7
- Intercepts every `bash` tool call and classifies the command against a set of severity rules before it runs. Two rule sets: **path rules** (block / warn / info) protect the `read` / `write` / `edit` tools from touching private keys, credential files, etc. — `block` is deny-first (15s timeout), `warn` is allow-first (30s), `info` is a blue notify that never blocks. **Command rules** (critical / dangerous / risky) gate `bash` invocations: `critical` (force pushes to main, recursive deletes, `dd` to disks, etc.) is hard-blocked in non-interactive mode and hard-denied via a 15-second auto-deny dialog in TUI mode; `dangerous` commands (including any `sudo` invocation, which is hard-redirected to the `sudo_run` tool — no bypass) show a 30-second auto-deny confirmation dialog; `risky` commands show a 60-second allow-first dialog and silently pass in non-interactive mode. Auto-approve patterns and extra rules can be configured in `~/.pi/agent/pix-gate.json`. Built-in rules can be replaced entirely by setting `disableDefaults: true` in the config file.
7
+ Intercepts every `bash` tool call and classifies the command against a set of severity rules before it runs. Two rule sets: **path rules** (block / warn / info) protect the `read` / `write` / `edit` tools from touching private keys, credential files, etc. — `block` is deny-first (15s timeout), `warn` is allow-first (30s), `info` is a blue notify that never blocks. **Command rules** (critical / dangerous / risky) gate `bash` invocations: `critical` (force pushes to main, recursive deletes, `dd` to disks, etc.) is hard-blocked in non-interactive mode and hard-denied via a 15-second auto-deny dialog in TUI mode; `dangerous` commands (including any `sudo` invocation, which is hard-redirected to the `sudo_run` tool — no bypass) show a 30-second auto-deny confirmation dialog; `risky` commands show a 60-second allow-first dialog and silently pass in non-interactive mode. Auto-approve patterns and extra rules can be configured in the `gate` section of `~/.pi/agent/pix.json`. Built-in rules can be turned off entirely by setting `guardrails: "off"` in that section.
8
8
 
9
9
  ## Install
10
10
 
@@ -42,7 +42,7 @@ Gate rules are read from the **`gate` section of `~/.pi/agent/pix.json`** (the u
42
42
  ```jsonc
43
43
  {
44
44
  "gate": {
45
- "disableDefaults": false,
45
+ "guardrails": "on",
46
46
  "extraRules": [
47
47
  { "pattern": "rm -rf /my-dir", "severity": "critical", "reason": "Deletes project root" }
48
48
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xynogen/pix-gate",
3
- "version": "0.2.2",
3
+ "version": "0.2.6",
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,9 +42,9 @@
42
42
  "access": "public"
43
43
  },
44
44
  "dependencies": {
45
- "@xynogen/pix-pretty": "^1.7.9",
46
- "@xynogen/pix-data": "^0.4.0",
47
- "@xynogen/pix-runtime": "^0.4.0"
45
+ "@xynogen/pix-pretty": "^1.11.2",
46
+ "@xynogen/pix-data": "^0.4.3",
47
+ "@xynogen/pix-runtime": "^0.5.3"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "@earendil-works/pi-coding-agent": "*",
package/src/gate.test.ts CHANGED
@@ -110,6 +110,10 @@ describe("extractPathsFromBash", () => {
110
110
  expect(extractPathsFromBash("jq -r '.key' data.json")).toEqual([]);
111
111
  });
112
112
 
113
+ test("does not treat Object.keys as a key file", () => {
114
+ expect(extractPathsFromBash('node -p "Object.keys(require(x))"')).toEqual([]);
115
+ });
116
+
113
117
  test("still extracts key file paths", () => {
114
118
  expect(extractPathsFromBash("cat private.key")).toContain("private.key");
115
119
  expect(extractPathsFromBash("cat .private.key")).toContain(".private.key");
package/src/lib.ts CHANGED
@@ -280,7 +280,7 @@ export function classifyPath(
280
280
  export function extractPathsFromBash(cmd: string): string[] {
281
281
  const out: string[] = [];
282
282
  const re =
283
- /(?:^|[\s=><|;&"'`(])((?:\.\.\/|\.\/|\/|~\/)[^\s"'`<>|;&)]+|\.env(?:\.[A-Za-z0-9_-]+)?|[A-Za-z0-9_./-]+\.(?:pem|key|p12|pfx|crt|cer|env|envrc|netrc))/g;
283
+ /(?:^|[\s=><|;&"'`(])((?:\.\.\/|\.\/|\/|~\/)[^\s"'`<>|;&)]+|(?:\.env(?:\.[A-Za-z0-9_-]+)?|[A-Za-z0-9_./-]+\.(?:pem|key|p12|pfx|crt|cer|env|envrc|netrc))(?![A-Za-z0-9]))/g;
284
284
  for (const m of cmd.matchAll(re)) out.push(m[1] ?? "");
285
285
  return out;
286
286
  }