@@ -6,52 +6,52 @@ import (
66
77func TestPermissionService_AllowedCommands(t *testing.T) {
88 tests := []struct {
9− name string
10− allowedCommands []string
11− toolName string
12− action string
13− expected bool
9+ name string
10+ allowedTools []string
11+ toolName string
12+ action string
13+ expected bool
1414 }{
1515 {
16− name: "tool in allowlist",
17− allowedCommands: []string{"bash", "view"},
18− toolName: "bash",
19− action: "execute",
20− expected: true,
16+ name: "tool in allowlist",
17+ allowedTools: []string{"bash", "view"},
18+ toolName: "bash",
19+ action: "execute",
20+ expected: true,
2121 },
2222 {
23− name: "tool:action in allowlist",
24− allowedCommands: []string{"bash:execute", "edit:create"},
25− toolName: "bash",
26− action: "execute",
27− expected: true,
23+ name: "tool:action in allowlist",
24+ allowedTools: []string{"bash:execute", "edit:create"},
25+ toolName: "bash",
26+ action: "execute",
27+ expected: true,
2828 },
2929 {
30− name: "tool not in allowlist",
31− allowedCommands: []string{"view", "ls"},
32− toolName: "bash",
33− action: "execute",
34− expected: false,
30+ name: "tool not in allowlist",
31+ allowedTools: []string{"view", "ls"},
32+ toolName: "bash",
33+ action: "execute",
34+ expected: false,
3535 },
3636 {
37− name: "tool:action not in allowlist",
38− allowedCommands: []string{"bash:read", "edit:create"},
39− toolName: "bash",
40− action: "execute",
41− expected: false,
37+ name: "tool:action not in allowlist",
38+ allowedTools: []string{"bash:read", "edit:create"},
39+ toolName: "bash",
40+ action: "execute",
41+ expected: false,
4242 },
4343 {
44− name: "empty allowlist",
45− allowedCommands: []string{},
46− toolName: "bash",
47− action: "execute",
48− expected: false,
44+ name: "empty allowlist",
45+ allowedTools: []string{},
46+ toolName: "bash",
47+ action: "execute",
48+ expected: false,
4949 },
5050 }
5151
5252 for _, tt := range tests {
5353 t.Run(tt.name, func(t *testing.T) {
54− service := NewPermissionService("/tmp", false, tt.allowedCommands)
54+ service := NewPermissionService("/tmp", false, tt.allowedTools)
5555
5656 // Create a channel to capture the permission request
5757 // Since we're testing the allowlist logic, we need to simulate the request
@@ -60,7 +60,7 @@ func TestPermissionService_AllowedCommands(t *testing.T) {
6060 // Test the allowlist logic directly
6161 commandKey := tt.toolName + ":" + tt.action
6262 allowed := false
63− for _, cmd := range ps.allowedCommands {
63+ for _, cmd := range ps.allowedTools {
6464 if cmd == commandKey || cmd == tt.toolName {
6565 allowed = true
6666 break
@@ -69,7 +69,7 @@ func TestPermissionService_AllowedCommands(t *testing.T) {
6969
7070 if allowed != tt.expected {
7171 t.Errorf("expected %v, got %v for tool %s action %s with allowlist %v",
72− tt.expected, allowed, tt.toolName, tt.action, tt.allowedCommands)
72+ tt.expected, allowed, tt.toolName, tt.action, tt.allowedTools)
7373 }
7474 })
7575 }