-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-bypass.js
More file actions
76 lines (67 loc) · 2.31 KB
/
test-bypass.js
File metadata and controls
76 lines (67 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env node
// Quick test to verify bypass functionality
const {
ClaudeExecutor,
} = require("./cli/dist/src/core/services/ClaudeExecutor");
class TestLogger {
info(message) {
console.log(`[INFO] ${message}`);
}
warn(message) {
console.warn(`[WARN] ${message}`);
}
error(message, error) {
console.error(`[ERROR] ${message}`, error || "");
}
debug(message) {
console.log(`[DEBUG] ${message}`);
}
}
class TestConfigManager {
validateModel() {
return true;
}
validatePath() {
return true;
}
}
const logger = new TestLogger();
const configManager = new TestConfigManager();
const executor = new ClaudeExecutor(logger, configManager);
// Test 1: bypass_permissions should add --dangerously-skip-permissions
console.log("\n=== Test 1: bypassPermissions option ===");
const preview1 = executor.formatCommandPreview("Test task", "auto", "/tmp", {
bypassPermissions: true,
});
console.log(`Command: ${preview1}`);
console.log(
`Has --dangerously-skip-permissions: ${preview1.includes("--dangerously-skip-permissions")}`,
);
// Test 2: allow_all_tools should add --dangerously-skip-permissions
console.log("\n=== Test 2: allowAllTools option ===");
const preview2 = executor.formatCommandPreview("Test task", "auto", "/tmp", {
allowAllTools: true,
});
console.log(`Command: ${preview2}`);
console.log(
`Has --dangerously-skip-permissions: ${preview2.includes("--dangerously-skip-permissions")}`,
);
// Test 3: both options should still add --dangerously-skip-permissions (matches Go CLI logic)
console.log("\n=== Test 3: both bypassPermissions and allowAllTools ===");
const preview3 = executor.formatCommandPreview("Test task", "auto", "/tmp", {
bypassPermissions: true,
allowAllTools: true,
});
console.log(`Command: ${preview3}`);
console.log(
`Has --dangerously-skip-permissions: ${preview3.includes("--dangerously-skip-permissions")}`,
);
// Test 4: neither option should not add --dangerously-skip-permissions
console.log("\n=== Test 4: no bypass options ===");
const preview4 = executor.formatCommandPreview("Test task", "auto", "/tmp", {});
console.log(`Command: ${preview4}`);
console.log(
`Has --dangerously-skip-permissions: ${preview4.includes("--dangerously-skip-permissions")}`,
);
console.log("\n=== Test Summary ===");
console.log("✅ All bypass functionality tests completed");