axconfig 3.5.1 → 3.5.2

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.
@@ -76,6 +76,29 @@ export function collectBashPatterns(rules) {
76
76
  .filter((r) => r.type === "bash")
77
77
  .map((r) => r.pattern);
78
78
  }
79
+ /**
80
+ * Normalize a bash pattern for OpenCode by adding a trailing wildcard if needed.
81
+ *
82
+ * OpenCode uses an "arity" system to extract command prefixes for permission
83
+ * checking. For example, `gh` has arity 3, so `gh api repos/foo/bar` extracts
84
+ * the prefix `gh api repos/foo/bar` (first 3 tokens). A pattern `gh api` won't
85
+ * match because it's missing the third token.
86
+ *
87
+ * By appending `*` to patterns that don't already have wildcards, we ensure
88
+ * patterns like `gh api` become `gh api*` which matches `gh api repos/...`.
89
+ *
90
+ * @example
91
+ * normalizeBashPattern("gh api") // "gh api*"
92
+ * normalizeBashPattern("git *") // "git *" (already has wildcard)
93
+ * normalizeBashPattern("cat") // "cat*"
94
+ */
95
+ function normalizeBashPattern(pattern) {
96
+ // Don't add another * if pattern already ends with one
97
+ if (pattern.endsWith("*")) {
98
+ return pattern;
99
+ }
100
+ return `${pattern}*`;
101
+ }
79
102
  /**
80
103
  * Build bash permission config from patterns and tool permissions.
81
104
  *
@@ -101,10 +124,10 @@ export function buildBashPermission(allowPatterns, denyPatterns, bashAllowed, ba
101
124
  "*": bashAllowed ? "allow" : "deny",
102
125
  };
103
126
  for (const pattern of allowPatterns) {
104
- bashConfig[pattern] = "allow";
127
+ bashConfig[normalizeBashPattern(pattern)] = "allow";
105
128
  }
106
129
  for (const pattern of denyPatterns) {
107
- bashConfig[pattern] = "deny";
130
+ bashConfig[normalizeBashPattern(pattern)] = "deny";
108
131
  }
109
132
  return bashConfig;
110
133
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "axconfig",
3
3
  "author": "Łukasz Jerciński",
4
4
  "license": "MIT",
5
- "version": "3.5.1",
5
+ "version": "3.5.2",
6
6
  "description": "Unified configuration management for AI coding agents - common API for permissions, settings, and config across Claude Code, Codex, Gemini CLI, and OpenCode",
7
7
  "repository": {
8
8
  "type": "git",