@gotgenes/pi-permission-system 4.5.0 → 4.6.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 CHANGED
@@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [4.6.0](https://github.com/gotgenes/pi-permission-system/compare/v4.5.0...v4.6.0) (2026-05-05)
9
+
10
+
11
+ ### Features
12
+
13
+ * bump tsconfig target to ES2023 ([#60](https://github.com/gotgenes/pi-permission-system/issues/60)) ([7557ffd](https://github.com/gotgenes/pi-permission-system/commit/7557ffdc6ee17a03aeb173f5439b1aab3437a311))
14
+
15
+
16
+ ### Documentation
17
+
18
+ * plan tsconfig ES2023 bump ([#60](https://github.com/gotgenes/pi-permission-system/issues/60)) ([7005929](https://github.com/gotgenes/pi-permission-system/commit/70059296bb68a9f1aeb832ffdc9e89746c3d2c3e))
19
+ * **retro:** add retro notes for issue [#81](https://github.com/gotgenes/pi-permission-system/issues/81) ([7eb892e](https://github.com/gotgenes/pi-permission-system/commit/7eb892ee04c98e6edf8de7ddba5d1d973f1bc902))
20
+ * update AGENTS.md ES version floor to ES2023 ([#60](https://github.com/gotgenes/pi-permission-system/issues/60)) ([3fe87da](https://github.com/gotgenes/pi-permission-system/commit/3fe87da121a591ceb083506d0ac6a14b2cd8217a))
21
+
8
22
  ## [4.5.0](https://github.com/gotgenes/pi-permission-system/compare/v4.4.1...v4.5.0) (2026-05-05)
9
23
 
10
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gotgenes/pi-permission-system",
3
- "version": "4.5.0",
3
+ "version": "4.6.0",
4
4
  "description": "Permission enforcement extension for the Pi coding agent.",
5
5
  "type": "module",
6
6
  "files": [
package/src/rule.ts CHANGED
@@ -34,15 +34,11 @@ export function evaluate(
34
34
  rules: Ruleset,
35
35
  defaultAction?: PermissionState,
36
36
  ): Rule {
37
- for (let i = rules.length - 1; i >= 0; i -= 1) {
38
- const rule = rules[i];
39
- if (
40
- wildcardMatch(rule.surface, surface) &&
41
- wildcardMatch(rule.pattern, pattern)
42
- ) {
43
- return rule;
44
- }
45
- }
37
+ const rule = rules.findLast(
38
+ (r) =>
39
+ wildcardMatch(r.surface, surface) && wildcardMatch(r.pattern, pattern),
40
+ );
41
+ if (rule !== undefined) return rule;
46
42
  return { surface, pattern, action: defaultAction ?? "ask" };
47
43
  }
48
44
 
@@ -48,18 +48,13 @@ export function findCompiledWildcardMatch<TState>(
48
48
  patterns: readonly CompiledWildcardPattern<TState>[],
49
49
  name: string,
50
50
  ): WildcardPatternMatch<TState> | null {
51
- for (let index = patterns.length - 1; index >= 0; index -= 1) {
52
- const pattern = patterns[index];
53
- if (pattern.regex.test(name)) {
54
- return {
55
- state: pattern.state,
56
- matchedPattern: pattern.pattern,
57
- matchedName: name,
58
- };
59
- }
60
- }
61
-
62
- return null;
51
+ const match = patterns.findLast((p) => p.regex.test(name));
52
+ if (match === undefined) return null;
53
+ return {
54
+ state: match.state,
55
+ matchedPattern: match.pattern,
56
+ matchedName: name,
57
+ };
63
58
  }
64
59
 
65
60
  /**