@zeldrisho/pi-gate 0.4.1 → 0.5.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/CHANGELOG.md +8 -1
- package/README.md +3 -1
- package/package.json +4 -4
- package/src/config.ts +13 -3
- package/src/index.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.5.0] - 2026-09-24
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Use `gate.json` as the default configuration filename, retaining `pi-gate.json` as a legacy fallback only when `gate.json` is absent; existing files are never automatically renamed or overwritten.
|
|
15
|
+
|
|
10
16
|
## [0.4.1] - 2026-09-17
|
|
11
17
|
|
|
12
18
|
### Security
|
|
@@ -56,7 +62,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
56
62
|
- support `prompt`, `block`, and `allow` actions, with longest-pattern-wins resolution
|
|
57
63
|
- block rather than auto-approve in non-UI modes
|
|
58
64
|
|
|
59
|
-
[Unreleased]: https://github.com/zeldrisho/pi-packages/compare/pi-gate-v0.
|
|
65
|
+
[Unreleased]: https://github.com/zeldrisho/pi-packages/compare/pi-gate-v0.5.0...HEAD
|
|
66
|
+
[0.5.0]: https://github.com/zeldrisho/pi-packages/compare/pi-gate-v0.4.1...pi-gate-v0.5.0
|
|
60
67
|
[0.4.1]: https://github.com/zeldrisho/pi-packages/compare/pi-gate-v0.4.0...pi-gate-v0.4.1
|
|
61
68
|
[0.4.0]: https://github.com/zeldrisho/pi-packages/compare/pi-gate-v0.3.0...pi-gate-v0.4.0
|
|
62
69
|
[0.3.0]: https://github.com/zeldrisho/pi-packages/compare/pi-gate-v0.2.0...pi-gate-v0.3.0
|
package/README.md
CHANGED
|
@@ -12,7 +12,9 @@ pi install -l npm:@zeldrisho/pi-gate
|
|
|
12
12
|
|
|
13
13
|
## Configure
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
The extension reads `~/.pi/agent/gate.json`, falling back to legacy `~/.pi/agent/pi-gate.json` only when `gate.json` is absent. Set `PI_CODING_AGENT_DIR` to use a different configuration directory. If both files exist, only `gate.json` is used—even if it is invalid. To migrate, rename `pi-gate.json` to `gate.json` and run `/reload`; existing files are never automatically renamed, merged, or overwritten.
|
|
16
|
+
|
|
17
|
+
On first load, if neither file exists, the extension creates `gate.json` with starter rules and a 30-second prompt timeout. If no configuration can be created yet, pi-gate warns at session start and allows commands until the file is created. If an existing configuration cannot be read or parsed, pi-gate warns and prompts for every command until it is fixed. The published package includes [`config.schema.json`](config.schema.json); use this schema URL for editor completion:
|
|
16
18
|
|
|
17
19
|
```json
|
|
18
20
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeldrisho/pi-gate",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Pi extension that blocks or confirms bash commands based on a user-provided JSON configuration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"command-blocking",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@earendil-works/pi-coding-agent": "^0.
|
|
35
|
+
"@earendil-works/pi-coding-agent": "^0.85.1",
|
|
36
36
|
"typescript": "^7.0.2",
|
|
37
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@0.3.
|
|
38
|
-
"vite-plus": "0.3.
|
|
37
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@0.3.3",
|
|
38
|
+
"vite-plus": "0.3.3"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@earendil-works/pi-coding-agent": "*"
|
package/src/config.ts
CHANGED
|
@@ -16,7 +16,9 @@ export interface ConfigLoadResult {
|
|
|
16
16
|
status: ConfigLoadStatus;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
const CONFIG_FILE_NAME = "
|
|
19
|
+
const CONFIG_FILE_NAME = "gate.json";
|
|
20
|
+
|
|
21
|
+
const LEGACY_CONFIG_FILE_NAME = "pi-gate.json";
|
|
20
22
|
|
|
21
23
|
export const CONFIG_SCHEMA_URL =
|
|
22
24
|
"https://raw.githubusercontent.com/zeldrisho/pi-packages/main/packages/pi-gate/config.schema.json";
|
|
@@ -54,10 +56,18 @@ function agentDir(): string {
|
|
|
54
56
|
/**
|
|
55
57
|
* Returns the full path to the pi-gate configuration file.
|
|
56
58
|
*
|
|
57
|
-
*
|
|
59
|
+
* Prefers gate.json, falling back to pi-gate.json only when gate.json is absent.
|
|
60
|
+
*
|
|
61
|
+
* @returns The selected configuration path, or gate.json for first-run creation
|
|
58
62
|
*/
|
|
59
63
|
export function configPath(): string {
|
|
60
|
-
|
|
64
|
+
const path = join(agentDir(), CONFIG_FILE_NAME);
|
|
65
|
+
|
|
66
|
+
if (existsSync(path)) return path;
|
|
67
|
+
|
|
68
|
+
const legacyPath = join(agentDir(), LEGACY_CONFIG_FILE_NAME);
|
|
69
|
+
|
|
70
|
+
return existsSync(legacyPath) ? legacyPath : path;
|
|
61
71
|
}
|
|
62
72
|
|
|
63
73
|
/**
|
package/src/index.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* user-provided JSON configuration. Without a configuration file, the
|
|
6
6
|
* extension creates one with starter rules and a default prompt timeout.
|
|
7
7
|
*
|
|
8
|
-
* Configuration file: `~/.pi/agent/pi-gate.json`
|
|
8
|
+
* Configuration file: `~/.pi/agent/gate.json` (legacy fallback: `pi-gate.json`)
|
|
9
9
|
*
|
|
10
10
|
* The configuration has an `operations` section, which maps a substring
|
|
11
11
|
* pattern to one of three actions, and an optional `promptTimeoutMs` setting:
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* narrow `allow` rule can override a broader `prompt` or `block` rule.
|
|
19
19
|
*
|
|
20
20
|
* On first run, a configuration with the default prompt timeout and starter
|
|
21
|
-
* operation rules is written to `~/.pi/agent/
|
|
21
|
+
* operation rules is written to `~/.pi/agent/gate.json` when neither file exists.
|
|
22
22
|
*
|
|
23
23
|
* Non-UI modes (print, JSON) never auto-approve. A `prompt` or `block` rule
|
|
24
24
|
* in non-UI mode always blocks and requests termination of the agent turn.
|