( ruleString: string, )
| 61 | // Local copies to avoid circular dependency |
| 62 | // (permissions.ts imports SandboxManager, bashPermissions.ts imports permissions.ts) |
| 63 | function permissionRuleValueFromString( |
| 64 | ruleString: string, |
| 65 | ): PermissionRuleValue { |
| 66 | const matches = ruleString.match(/^([^(]+)\(([^)]+)\)$/) |
| 67 | if (!matches) { |
| 68 | return { toolName: ruleString } |
| 69 | } |
| 70 | const toolName = matches[1] |
| 71 | const ruleContent = matches[2] |
| 72 | if (!toolName || !ruleContent) { |
| 73 | return { toolName: ruleString } |
| 74 | } |
| 75 | return { toolName, ruleContent } |
| 76 | } |
| 77 | |
| 78 | function permissionRuleExtractPrefix(permissionRule: string): string | null { |
| 79 | const match = permissionRule.match(/^(.+):\*$/) |
no outgoing calls
no test coverage detected