claude-yolo-extended 1.9.2 → 1.9.4
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/.claude/commands/shutdown.md +17 -17
- package/.claude/commands/startup.md +13 -13
- package/.github/workflows/publish.yml +34 -0
- package/AI_HANDOFF.md +13 -15
- package/CLAUDE.md +83 -83
- package/README.md +243 -243
- package/bin/ascii-art.js +64 -64
- package/bin/cl +116 -116
- package/bin/cl.js +136 -136
- package/bin/cl.ps1 +36 -36
- package/bin/claude-yolo.js +387 -387
- package/package.json +41 -41
- package/postinstall.js +51 -51
package/bin/cl
CHANGED
|
@@ -1,117 +1,117 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Claude YOLO/SAFE Mode Wrapper Script
|
|
4
|
-
# Usage: cl /YON | /YOFF | /STATUS | /HELP | [claude commands]
|
|
5
|
-
|
|
6
|
-
# Barvy pro výstup
|
|
7
|
-
RED='\033[0;31m'
|
|
8
|
-
YELLOW='\033[1;33m'
|
|
9
|
-
CYAN='\033[0;36m'
|
|
10
|
-
GREEN='\033[0;32m'
|
|
11
|
-
RESET='\033[0m'
|
|
12
|
-
BOLD='\033[1m'
|
|
13
|
-
|
|
14
|
-
# Soubor pro uložení stavu
|
|
15
|
-
STATE_FILE="$HOME/.claude_yolo_state"
|
|
16
|
-
|
|
17
|
-
# Funkce pro čtení aktuálního režimu
|
|
18
|
-
get_mode() {
|
|
19
|
-
if [ -f "$STATE_FILE" ]; then
|
|
20
|
-
cat "$STATE_FILE"
|
|
21
|
-
else
|
|
22
|
-
echo "SAFE" # Výchozí je bezpečný režim
|
|
23
|
-
fi
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
# Funkce pro nastavení režimu
|
|
27
|
-
set_mode() {
|
|
28
|
-
echo "$1" > "$STATE_FILE"
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
# Zpracování argumentů
|
|
32
|
-
case "$1" in
|
|
33
|
-
/YON)
|
|
34
|
-
echo -e "${YELLOW}${BOLD}🔥 ACTIVATING YOLO MODE 🔥${RESET}"
|
|
35
|
-
echo -e "${RED}⚠️ WARNING: All safety checks will be DISABLED!${RESET}"
|
|
36
|
-
echo -e "${RED}⚠️ Claude can access ANY file without asking!${RESET}"
|
|
37
|
-
set_mode "YOLO"
|
|
38
|
-
echo -e "${YELLOW}✓ YOLO mode is now ON${RESET}"
|
|
39
|
-
;;
|
|
40
|
-
|
|
41
|
-
/YOFF)
|
|
42
|
-
echo -e "${CYAN}${BOLD}🛡️ ACTIVATING SAFE MODE 🛡️${RESET}"
|
|
43
|
-
echo -e "${GREEN}✓ Safety checks will be enabled${RESET}"
|
|
44
|
-
echo -e "${GREEN}✓ Claude will ask for permissions${RESET}"
|
|
45
|
-
set_mode "SAFE"
|
|
46
|
-
echo -e "${CYAN}✓ YOLO mode is now OFF (Safe mode ON)${RESET}"
|
|
47
|
-
;;
|
|
48
|
-
|
|
49
|
-
/STATUS)
|
|
50
|
-
MODE=$(get_mode)
|
|
51
|
-
echo -e "${BOLD}Claude CLI Status:${RESET}"
|
|
52
|
-
echo -e "━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
53
|
-
if [ "$MODE" = "YOLO" ]; then
|
|
54
|
-
echo -e "Mode: ${YELLOW}${BOLD}YOLO${RESET} 🔥"
|
|
55
|
-
echo -e "Safety: ${RED}DISABLED${RESET}"
|
|
56
|
-
echo -e "Permissions: ${RED}BYPASSED${RESET}"
|
|
57
|
-
else
|
|
58
|
-
echo -e "Mode: ${CYAN}${BOLD}SAFE${RESET} 🛡️"
|
|
59
|
-
echo -e "Safety: ${GREEN}ENABLED${RESET}"
|
|
60
|
-
echo -e "Permissions: ${GREEN}REQUIRED${RESET}"
|
|
61
|
-
fi
|
|
62
|
-
echo -e "━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
63
|
-
;;
|
|
64
|
-
|
|
65
|
-
/HELP|/H|/?)
|
|
66
|
-
echo -e "${BOLD}Claude CLI Wrapper - Help${RESET}"
|
|
67
|
-
echo -e "━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
68
|
-
echo -e "${CYAN}cl /YON${RESET} - Enable YOLO mode (bypass safety)"
|
|
69
|
-
echo -e "${CYAN}cl /YOFF${RESET} - Disable YOLO mode (safe mode)"
|
|
70
|
-
echo -e "${CYAN}cl /STATUS${RESET} - Show current mode"
|
|
71
|
-
echo -e "${CYAN}cl /HELP${RESET} - Show this help"
|
|
72
|
-
echo -e "${CYAN}cl [args]${RESET} - Run claude with current mode"
|
|
73
|
-
echo -e "━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
74
|
-
echo -e ""
|
|
75
|
-
echo -e "${BOLD}Examples:${RESET}"
|
|
76
|
-
echo -e " cl /YON # Enable YOLO mode"
|
|
77
|
-
echo -e " cl /YOFF # Enable SAFE mode"
|
|
78
|
-
echo -e " cl \"write a function\" # Run Claude in current mode"
|
|
79
|
-
echo -e ""
|
|
80
|
-
echo -e "${BOLD}Mode Persistence:${RESET}"
|
|
81
|
-
echo -e "Your mode choice is saved in ~/.claude_yolo_state"
|
|
82
|
-
echo -e "and persists between terminal sessions."
|
|
83
|
-
;;
|
|
84
|
-
|
|
85
|
-
*)
|
|
86
|
-
# Spustit Claude v aktuálním režimu
|
|
87
|
-
MODE=$(get_mode)
|
|
88
|
-
|
|
89
|
-
# Zobrazit režim před spuštěním
|
|
90
|
-
if [ "$MODE" = "YOLO" ]; then
|
|
91
|
-
echo -e "${YELLOW}[YOLO]${RESET} Running Claude in YOLO mode..."
|
|
92
|
-
# Check if claude-yolo-extended is installed
|
|
93
|
-
if command -v claude-yolo-extended &> /dev/null; then
|
|
94
|
-
claude-yolo-extended "$@"
|
|
95
|
-
else
|
|
96
|
-
echo -e "${RED}Error: claude-yolo-extended is not installed${RESET}"
|
|
97
|
-
echo -e "Install it with: ${CYAN}npm install -g claude-yolo-extended${RESET}"
|
|
98
|
-
exit 1
|
|
99
|
-
fi
|
|
100
|
-
else
|
|
101
|
-
echo -e "${CYAN}[SAFE]${RESET} Running Claude in SAFE mode..."
|
|
102
|
-
# Check if claude is installed
|
|
103
|
-
if command -v claude &> /dev/null; then
|
|
104
|
-
claude "$@"
|
|
105
|
-
else
|
|
106
|
-
# If regular claude is not installed, use claude-yolo-extended with --safe flag
|
|
107
|
-
if command -v claude-yolo-extended &> /dev/null; then
|
|
108
|
-
claude-yolo-extended --safe "$@"
|
|
109
|
-
else
|
|
110
|
-
echo -e "${RED}Error: Neither claude nor claude-yolo-extended is installed${RESET}"
|
|
111
|
-
echo -e "Install claude-yolo-extended with: ${CYAN}npm install -g claude-yolo-extended${RESET}"
|
|
112
|
-
exit 1
|
|
113
|
-
fi
|
|
114
|
-
fi
|
|
115
|
-
fi
|
|
116
|
-
;;
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Claude YOLO/SAFE Mode Wrapper Script
|
|
4
|
+
# Usage: cl /YON | /YOFF | /STATUS | /HELP | [claude commands]
|
|
5
|
+
|
|
6
|
+
# Barvy pro výstup
|
|
7
|
+
RED='\033[0;31m'
|
|
8
|
+
YELLOW='\033[1;33m'
|
|
9
|
+
CYAN='\033[0;36m'
|
|
10
|
+
GREEN='\033[0;32m'
|
|
11
|
+
RESET='\033[0m'
|
|
12
|
+
BOLD='\033[1m'
|
|
13
|
+
|
|
14
|
+
# Soubor pro uložení stavu
|
|
15
|
+
STATE_FILE="$HOME/.claude_yolo_state"
|
|
16
|
+
|
|
17
|
+
# Funkce pro čtení aktuálního režimu
|
|
18
|
+
get_mode() {
|
|
19
|
+
if [ -f "$STATE_FILE" ]; then
|
|
20
|
+
cat "$STATE_FILE"
|
|
21
|
+
else
|
|
22
|
+
echo "SAFE" # Výchozí je bezpečný režim
|
|
23
|
+
fi
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
# Funkce pro nastavení režimu
|
|
27
|
+
set_mode() {
|
|
28
|
+
echo "$1" > "$STATE_FILE"
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
# Zpracování argumentů
|
|
32
|
+
case "$1" in
|
|
33
|
+
/YON)
|
|
34
|
+
echo -e "${YELLOW}${BOLD}🔥 ACTIVATING YOLO MODE 🔥${RESET}"
|
|
35
|
+
echo -e "${RED}⚠️ WARNING: All safety checks will be DISABLED!${RESET}"
|
|
36
|
+
echo -e "${RED}⚠️ Claude can access ANY file without asking!${RESET}"
|
|
37
|
+
set_mode "YOLO"
|
|
38
|
+
echo -e "${YELLOW}✓ YOLO mode is now ON${RESET}"
|
|
39
|
+
;;
|
|
40
|
+
|
|
41
|
+
/YOFF)
|
|
42
|
+
echo -e "${CYAN}${BOLD}🛡️ ACTIVATING SAFE MODE 🛡️${RESET}"
|
|
43
|
+
echo -e "${GREEN}✓ Safety checks will be enabled${RESET}"
|
|
44
|
+
echo -e "${GREEN}✓ Claude will ask for permissions${RESET}"
|
|
45
|
+
set_mode "SAFE"
|
|
46
|
+
echo -e "${CYAN}✓ YOLO mode is now OFF (Safe mode ON)${RESET}"
|
|
47
|
+
;;
|
|
48
|
+
|
|
49
|
+
/STATUS)
|
|
50
|
+
MODE=$(get_mode)
|
|
51
|
+
echo -e "${BOLD}Claude CLI Status:${RESET}"
|
|
52
|
+
echo -e "━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
53
|
+
if [ "$MODE" = "YOLO" ]; then
|
|
54
|
+
echo -e "Mode: ${YELLOW}${BOLD}YOLO${RESET} 🔥"
|
|
55
|
+
echo -e "Safety: ${RED}DISABLED${RESET}"
|
|
56
|
+
echo -e "Permissions: ${RED}BYPASSED${RESET}"
|
|
57
|
+
else
|
|
58
|
+
echo -e "Mode: ${CYAN}${BOLD}SAFE${RESET} 🛡️"
|
|
59
|
+
echo -e "Safety: ${GREEN}ENABLED${RESET}"
|
|
60
|
+
echo -e "Permissions: ${GREEN}REQUIRED${RESET}"
|
|
61
|
+
fi
|
|
62
|
+
echo -e "━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
63
|
+
;;
|
|
64
|
+
|
|
65
|
+
/HELP|/H|/?)
|
|
66
|
+
echo -e "${BOLD}Claude CLI Wrapper - Help${RESET}"
|
|
67
|
+
echo -e "━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
68
|
+
echo -e "${CYAN}cl /YON${RESET} - Enable YOLO mode (bypass safety)"
|
|
69
|
+
echo -e "${CYAN}cl /YOFF${RESET} - Disable YOLO mode (safe mode)"
|
|
70
|
+
echo -e "${CYAN}cl /STATUS${RESET} - Show current mode"
|
|
71
|
+
echo -e "${CYAN}cl /HELP${RESET} - Show this help"
|
|
72
|
+
echo -e "${CYAN}cl [args]${RESET} - Run claude with current mode"
|
|
73
|
+
echo -e "━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
74
|
+
echo -e ""
|
|
75
|
+
echo -e "${BOLD}Examples:${RESET}"
|
|
76
|
+
echo -e " cl /YON # Enable YOLO mode"
|
|
77
|
+
echo -e " cl /YOFF # Enable SAFE mode"
|
|
78
|
+
echo -e " cl \"write a function\" # Run Claude in current mode"
|
|
79
|
+
echo -e ""
|
|
80
|
+
echo -e "${BOLD}Mode Persistence:${RESET}"
|
|
81
|
+
echo -e "Your mode choice is saved in ~/.claude_yolo_state"
|
|
82
|
+
echo -e "and persists between terminal sessions."
|
|
83
|
+
;;
|
|
84
|
+
|
|
85
|
+
*)
|
|
86
|
+
# Spustit Claude v aktuálním režimu
|
|
87
|
+
MODE=$(get_mode)
|
|
88
|
+
|
|
89
|
+
# Zobrazit režim před spuštěním
|
|
90
|
+
if [ "$MODE" = "YOLO" ]; then
|
|
91
|
+
echo -e "${YELLOW}[YOLO]${RESET} Running Claude in YOLO mode..."
|
|
92
|
+
# Check if claude-yolo-extended is installed
|
|
93
|
+
if command -v claude-yolo-extended &> /dev/null; then
|
|
94
|
+
claude-yolo-extended "$@"
|
|
95
|
+
else
|
|
96
|
+
echo -e "${RED}Error: claude-yolo-extended is not installed${RESET}"
|
|
97
|
+
echo -e "Install it with: ${CYAN}npm install -g claude-yolo-extended${RESET}"
|
|
98
|
+
exit 1
|
|
99
|
+
fi
|
|
100
|
+
else
|
|
101
|
+
echo -e "${CYAN}[SAFE]${RESET} Running Claude in SAFE mode..."
|
|
102
|
+
# Check if claude is installed
|
|
103
|
+
if command -v claude &> /dev/null; then
|
|
104
|
+
claude "$@"
|
|
105
|
+
else
|
|
106
|
+
# If regular claude is not installed, use claude-yolo-extended with --safe flag
|
|
107
|
+
if command -v claude-yolo-extended &> /dev/null; then
|
|
108
|
+
claude-yolo-extended --safe "$@"
|
|
109
|
+
else
|
|
110
|
+
echo -e "${RED}Error: Neither claude nor claude-yolo-extended is installed${RESET}"
|
|
111
|
+
echo -e "Install claude-yolo-extended with: ${CYAN}npm install -g claude-yolo-extended${RESET}"
|
|
112
|
+
exit 1
|
|
113
|
+
fi
|
|
114
|
+
fi
|
|
115
|
+
fi
|
|
116
|
+
;;
|
|
117
117
|
esac
|
package/bin/cl.js
CHANGED
|
@@ -1,137 +1,137 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import fs from 'fs';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
import { spawn } from 'child_process';
|
|
6
|
-
import os from 'os';
|
|
7
|
-
import { fileURLToPath } from 'url';
|
|
8
|
-
import { showYoloActivated, showSafeActivated, showModeStatus } from './ascii-art.js';
|
|
9
|
-
|
|
10
|
-
// Get the directory of the current module
|
|
11
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
12
|
-
|
|
13
|
-
// ANSI color codes
|
|
14
|
-
const RED = '\x1b[31m';
|
|
15
|
-
const YELLOW = '\x1b[33m';
|
|
16
|
-
const CYAN = '\x1b[36m';
|
|
17
|
-
const GREEN = '\x1b[32m';
|
|
18
|
-
const RESET = '\x1b[0m';
|
|
19
|
-
const BOLD = '\x1b[1m';
|
|
20
|
-
|
|
21
|
-
// State file path
|
|
22
|
-
const stateFile = path.join(os.homedir(), '.claude_yolo_state');
|
|
23
|
-
|
|
24
|
-
// Function to get current mode
|
|
25
|
-
function getMode() {
|
|
26
|
-
try {
|
|
27
|
-
return fs.readFileSync(stateFile, 'utf8').trim();
|
|
28
|
-
} catch {
|
|
29
|
-
return 'YOLO'; // Default to YOLO mode (matches claude-yolo-extended behavior)
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Function to set mode
|
|
34
|
-
function setMode(mode) {
|
|
35
|
-
fs.writeFileSync(stateFile, mode);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Get command line arguments
|
|
39
|
-
const args = process.argv.slice(2);
|
|
40
|
-
|
|
41
|
-
// Handle special commands
|
|
42
|
-
if (args.length > 0) {
|
|
43
|
-
const command = args[0].toUpperCase();
|
|
44
|
-
|
|
45
|
-
switch (command) {
|
|
46
|
-
case '/YON':
|
|
47
|
-
showYoloActivated();
|
|
48
|
-
setMode('YOLO');
|
|
49
|
-
console.log(`${YELLOW}✓ YOLO mode is now ON${RESET}`);
|
|
50
|
-
|
|
51
|
-
// Auto-start with remaining args
|
|
52
|
-
if (args.length > 1) {
|
|
53
|
-
runClaude(args.slice(1));
|
|
54
|
-
} else {
|
|
55
|
-
runClaude([]);
|
|
56
|
-
}
|
|
57
|
-
break;
|
|
58
|
-
|
|
59
|
-
case '/YOFF':
|
|
60
|
-
showSafeActivated();
|
|
61
|
-
setMode('SAFE');
|
|
62
|
-
console.log(`${CYAN}✓ YOLO mode is now OFF (Safe mode ON)${RESET}`);
|
|
63
|
-
|
|
64
|
-
// Auto-start with remaining args
|
|
65
|
-
if (args.length > 1) {
|
|
66
|
-
runClaude(args.slice(1));
|
|
67
|
-
} else {
|
|
68
|
-
runClaude([]);
|
|
69
|
-
}
|
|
70
|
-
break;
|
|
71
|
-
|
|
72
|
-
case '/STATUS':
|
|
73
|
-
const mode = getMode();
|
|
74
|
-
showModeStatus(mode);
|
|
75
|
-
break;
|
|
76
|
-
|
|
77
|
-
case '/HELP':
|
|
78
|
-
case '/H':
|
|
79
|
-
case '/?':
|
|
80
|
-
console.log(`${BOLD}Claude CLI Wrapper - Help${RESET}`);
|
|
81
|
-
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
82
|
-
console.log(`${CYAN}cl /YON${RESET} - Enable YOLO mode (bypass safety)`);
|
|
83
|
-
console.log(`${CYAN}cl /YOFF${RESET} - Disable YOLO mode (safe mode)`);
|
|
84
|
-
console.log(`${CYAN}cl /STATUS${RESET} - Show current mode`);
|
|
85
|
-
console.log(`${CYAN}cl /HELP${RESET} - Show this help`);
|
|
86
|
-
console.log(`${CYAN}cl [args]${RESET} - Run claude with current mode`);
|
|
87
|
-
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
88
|
-
console.log('');
|
|
89
|
-
console.log(`${BOLD}Examples:${RESET}`);
|
|
90
|
-
console.log(' cl /YON # Enable YOLO mode');
|
|
91
|
-
console.log(' cl /YOFF # Enable SAFE mode');
|
|
92
|
-
console.log(' cl "write a function" # Run Claude in current mode');
|
|
93
|
-
console.log('');
|
|
94
|
-
console.log(`${BOLD}Mode Persistence:${RESET}`);
|
|
95
|
-
console.log('Your mode choice is saved in ~/.claude_yolo_state');
|
|
96
|
-
console.log('and persists between terminal sessions.');
|
|
97
|
-
break;
|
|
98
|
-
|
|
99
|
-
default:
|
|
100
|
-
// Run Claude with provided arguments
|
|
101
|
-
runClaude(args);
|
|
102
|
-
}
|
|
103
|
-
} else {
|
|
104
|
-
// No arguments, just run Claude
|
|
105
|
-
runClaude([]);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function runClaude(claudeArgs) {
|
|
109
|
-
const mode = getMode();
|
|
110
|
-
|
|
111
|
-
// Show current mode
|
|
112
|
-
if (mode === 'YOLO') {
|
|
113
|
-
console.log(`${YELLOW}[YOLO]${RESET} Running Claude in YOLO mode...`);
|
|
114
|
-
} else {
|
|
115
|
-
console.log(`${CYAN}[SAFE]${RESET} Running Claude in SAFE mode...`);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// Determine which command to run
|
|
119
|
-
const command = 'claude-yolo-extended';
|
|
120
|
-
const commandArgs = mode === 'SAFE' ? ['--safe', ...claudeArgs] : claudeArgs;
|
|
121
|
-
|
|
122
|
-
// Spawn the process
|
|
123
|
-
const child = spawn(command, commandArgs, {
|
|
124
|
-
stdio: 'inherit',
|
|
125
|
-
shell: true
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
child.on('error', (err) => {
|
|
129
|
-
console.error(`${RED}Error: Failed to start ${command}${RESET}`);
|
|
130
|
-
console.error(err.message);
|
|
131
|
-
process.exit(1);
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
child.on('exit', (code) => {
|
|
135
|
-
process.exit(code || 0);
|
|
136
|
-
});
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import { spawn } from 'child_process';
|
|
6
|
+
import os from 'os';
|
|
7
|
+
import { fileURLToPath } from 'url';
|
|
8
|
+
import { showYoloActivated, showSafeActivated, showModeStatus } from './ascii-art.js';
|
|
9
|
+
|
|
10
|
+
// Get the directory of the current module
|
|
11
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
12
|
+
|
|
13
|
+
// ANSI color codes
|
|
14
|
+
const RED = '\x1b[31m';
|
|
15
|
+
const YELLOW = '\x1b[33m';
|
|
16
|
+
const CYAN = '\x1b[36m';
|
|
17
|
+
const GREEN = '\x1b[32m';
|
|
18
|
+
const RESET = '\x1b[0m';
|
|
19
|
+
const BOLD = '\x1b[1m';
|
|
20
|
+
|
|
21
|
+
// State file path
|
|
22
|
+
const stateFile = path.join(os.homedir(), '.claude_yolo_state');
|
|
23
|
+
|
|
24
|
+
// Function to get current mode
|
|
25
|
+
function getMode() {
|
|
26
|
+
try {
|
|
27
|
+
return fs.readFileSync(stateFile, 'utf8').trim();
|
|
28
|
+
} catch {
|
|
29
|
+
return 'YOLO'; // Default to YOLO mode (matches claude-yolo-extended behavior)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Function to set mode
|
|
34
|
+
function setMode(mode) {
|
|
35
|
+
fs.writeFileSync(stateFile, mode);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Get command line arguments
|
|
39
|
+
const args = process.argv.slice(2);
|
|
40
|
+
|
|
41
|
+
// Handle special commands
|
|
42
|
+
if (args.length > 0) {
|
|
43
|
+
const command = args[0].toUpperCase();
|
|
44
|
+
|
|
45
|
+
switch (command) {
|
|
46
|
+
case '/YON':
|
|
47
|
+
showYoloActivated();
|
|
48
|
+
setMode('YOLO');
|
|
49
|
+
console.log(`${YELLOW}✓ YOLO mode is now ON${RESET}`);
|
|
50
|
+
|
|
51
|
+
// Auto-start with remaining args
|
|
52
|
+
if (args.length > 1) {
|
|
53
|
+
runClaude(args.slice(1));
|
|
54
|
+
} else {
|
|
55
|
+
runClaude([]);
|
|
56
|
+
}
|
|
57
|
+
break;
|
|
58
|
+
|
|
59
|
+
case '/YOFF':
|
|
60
|
+
showSafeActivated();
|
|
61
|
+
setMode('SAFE');
|
|
62
|
+
console.log(`${CYAN}✓ YOLO mode is now OFF (Safe mode ON)${RESET}`);
|
|
63
|
+
|
|
64
|
+
// Auto-start with remaining args
|
|
65
|
+
if (args.length > 1) {
|
|
66
|
+
runClaude(args.slice(1));
|
|
67
|
+
} else {
|
|
68
|
+
runClaude([]);
|
|
69
|
+
}
|
|
70
|
+
break;
|
|
71
|
+
|
|
72
|
+
case '/STATUS':
|
|
73
|
+
const mode = getMode();
|
|
74
|
+
showModeStatus(mode);
|
|
75
|
+
break;
|
|
76
|
+
|
|
77
|
+
case '/HELP':
|
|
78
|
+
case '/H':
|
|
79
|
+
case '/?':
|
|
80
|
+
console.log(`${BOLD}Claude CLI Wrapper - Help${RESET}`);
|
|
81
|
+
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
82
|
+
console.log(`${CYAN}cl /YON${RESET} - Enable YOLO mode (bypass safety)`);
|
|
83
|
+
console.log(`${CYAN}cl /YOFF${RESET} - Disable YOLO mode (safe mode)`);
|
|
84
|
+
console.log(`${CYAN}cl /STATUS${RESET} - Show current mode`);
|
|
85
|
+
console.log(`${CYAN}cl /HELP${RESET} - Show this help`);
|
|
86
|
+
console.log(`${CYAN}cl [args]${RESET} - Run claude with current mode`);
|
|
87
|
+
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
88
|
+
console.log('');
|
|
89
|
+
console.log(`${BOLD}Examples:${RESET}`);
|
|
90
|
+
console.log(' cl /YON # Enable YOLO mode');
|
|
91
|
+
console.log(' cl /YOFF # Enable SAFE mode');
|
|
92
|
+
console.log(' cl "write a function" # Run Claude in current mode');
|
|
93
|
+
console.log('');
|
|
94
|
+
console.log(`${BOLD}Mode Persistence:${RESET}`);
|
|
95
|
+
console.log('Your mode choice is saved in ~/.claude_yolo_state');
|
|
96
|
+
console.log('and persists between terminal sessions.');
|
|
97
|
+
break;
|
|
98
|
+
|
|
99
|
+
default:
|
|
100
|
+
// Run Claude with provided arguments
|
|
101
|
+
runClaude(args);
|
|
102
|
+
}
|
|
103
|
+
} else {
|
|
104
|
+
// No arguments, just run Claude
|
|
105
|
+
runClaude([]);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function runClaude(claudeArgs) {
|
|
109
|
+
const mode = getMode();
|
|
110
|
+
|
|
111
|
+
// Show current mode
|
|
112
|
+
if (mode === 'YOLO') {
|
|
113
|
+
console.log(`${YELLOW}[YOLO]${RESET} Running Claude in YOLO mode...`);
|
|
114
|
+
} else {
|
|
115
|
+
console.log(`${CYAN}[SAFE]${RESET} Running Claude in SAFE mode...`);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Determine which command to run
|
|
119
|
+
const command = 'claude-yolo-extended';
|
|
120
|
+
const commandArgs = mode === 'SAFE' ? ['--safe', ...claudeArgs] : claudeArgs;
|
|
121
|
+
|
|
122
|
+
// Spawn the process
|
|
123
|
+
const child = spawn(command, commandArgs, {
|
|
124
|
+
stdio: 'inherit',
|
|
125
|
+
shell: true
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
child.on('error', (err) => {
|
|
129
|
+
console.error(`${RED}Error: Failed to start ${command}${RESET}`);
|
|
130
|
+
console.error(err.message);
|
|
131
|
+
process.exit(1);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
child.on('exit', (code) => {
|
|
135
|
+
process.exit(code || 0);
|
|
136
|
+
});
|
|
137
137
|
}
|
package/bin/cl.ps1
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
# Claude YOLO/SAFE Mode Wrapper Script
|
|
2
|
-
# Usage: cl.ps1 /YON | /YOFF | /STATUS | /HELP | [claude commands]
|
|
3
|
-
|
|
4
|
-
param(
|
|
5
|
-
[Parameter(Position=0)]
|
|
6
|
-
[string]$Command,
|
|
7
|
-
[Parameter(Position=1)]
|
|
8
|
-
[string]$Argument
|
|
9
|
-
)
|
|
10
|
-
|
|
11
|
-
# Colors for output
|
|
12
|
-
$RED = "`e[31m"
|
|
13
|
-
$YELLOW = "`e[33m"
|
|
14
|
-
$CYAN = "`e[36m"
|
|
15
|
-
$GREEN = "`e[32m"
|
|
16
|
-
$RESET = "`e[0m"
|
|
17
|
-
|
|
18
|
-
function Write-Colored($Text, $Color) {
|
|
19
|
-
Write-Host "$Color$Text$RESET"
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
# Check if Node.js is installed
|
|
23
|
-
if (-not (Get-Command node -ErrorAction SilentlyContinue)) {
|
|
24
|
-
Write-Colored "Error: Node.js is not installed. Please install Node.js first." $RED
|
|
25
|
-
exit 1
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
# Check if the main script exists
|
|
29
|
-
$scriptPath = Join-Path $PSScriptRoot "claude-yolo.js"
|
|
30
|
-
if (-not (Test-Path $scriptPath)) {
|
|
31
|
-
Write-Colored "Error: Main script not found. Please reinstall the package." $RED
|
|
32
|
-
exit 1
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
# Run the main script with arguments
|
|
36
|
-
& node $scriptPath $Command $Argument
|
|
1
|
+
# Claude YOLO/SAFE Mode Wrapper Script
|
|
2
|
+
# Usage: cl.ps1 /YON | /YOFF | /STATUS | /HELP | [claude commands]
|
|
3
|
+
|
|
4
|
+
param(
|
|
5
|
+
[Parameter(Position=0)]
|
|
6
|
+
[string]$Command,
|
|
7
|
+
[Parameter(Position=1)]
|
|
8
|
+
[string]$Argument
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
# Colors for output
|
|
12
|
+
$RED = "`e[31m"
|
|
13
|
+
$YELLOW = "`e[33m"
|
|
14
|
+
$CYAN = "`e[36m"
|
|
15
|
+
$GREEN = "`e[32m"
|
|
16
|
+
$RESET = "`e[0m"
|
|
17
|
+
|
|
18
|
+
function Write-Colored($Text, $Color) {
|
|
19
|
+
Write-Host "$Color$Text$RESET"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
# Check if Node.js is installed
|
|
23
|
+
if (-not (Get-Command node -ErrorAction SilentlyContinue)) {
|
|
24
|
+
Write-Colored "Error: Node.js is not installed. Please install Node.js first." $RED
|
|
25
|
+
exit 1
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
# Check if the main script exists
|
|
29
|
+
$scriptPath = Join-Path $PSScriptRoot "claude-yolo.js"
|
|
30
|
+
if (-not (Test-Path $scriptPath)) {
|
|
31
|
+
Write-Colored "Error: Main script not found. Please reinstall the package." $RED
|
|
32
|
+
exit 1
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
# Run the main script with arguments
|
|
36
|
+
& node $scriptPath $Command $Argument
|