claude-yolo 1.0.0 → 1.2.0
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/README.md +21 -4
- package/bin/claude-yolo.js +59 -1
- package/make-yolo.sh +31 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,17 +1,34 @@
|
|
|
1
1
|
# Claude YOLO
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A wrapper for the Claude CLI that always enables danger mode by bypassing Docker and internet permission checks.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
```
|
|
7
|
+
```bash
|
|
8
8
|
npm install -g claude-yolo
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
|
-
```
|
|
13
|
+
```bash
|
|
14
14
|
claude-yolo [options]
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
All arguments and options are passed directly to the Claude CLI.
|
|
17
|
+
All arguments and options are passed directly to the Claude CLI.
|
|
18
|
+
|
|
19
|
+
This wrapper:
|
|
20
|
+
1. Prints "YOLO" to the console
|
|
21
|
+
2. Directly modifies the Claude CLI code to bypass permission checks
|
|
22
|
+
- Replaces all `getIsDocker()` calls with `true`
|
|
23
|
+
- Replaces all `hasInternetAccess()` calls with `false`
|
|
24
|
+
3. Creates a backup of the original CLI file
|
|
25
|
+
4. Adds the `--dangerously-skip-permissions` flag to command line arguments
|
|
26
|
+
5. Imports the modified CLI
|
|
27
|
+
|
|
28
|
+
## Why?
|
|
29
|
+
|
|
30
|
+
Sometimes you just want to YOLO and skip those pesky permission checks.
|
|
31
|
+
|
|
32
|
+
## Disclaimer
|
|
33
|
+
|
|
34
|
+
This is an unofficial tool and not supported by Anthropic. Use at your own risk.
|
package/bin/claude-yolo.js
CHANGED
|
@@ -2,4 +2,62 @@
|
|
|
2
2
|
|
|
3
3
|
console.log("YOLO");
|
|
4
4
|
|
|
5
|
-
import '
|
|
5
|
+
import fs from 'fs';
|
|
6
|
+
import path from 'path';
|
|
7
|
+
import { createRequire } from 'module';
|
|
8
|
+
import { fileURLToPath } from 'url';
|
|
9
|
+
|
|
10
|
+
// Debug logging function that only logs if DEBUG env var is set
|
|
11
|
+
const debug = (message) => {
|
|
12
|
+
if (process.env.DEBUG) {
|
|
13
|
+
console.log(message);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// Get the directory of the current module
|
|
18
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
19
|
+
const require = createRequire(import.meta.url);
|
|
20
|
+
|
|
21
|
+
// Find node_modules directory by walking up from current file
|
|
22
|
+
let nodeModulesDir = path.resolve(__dirname, '..');
|
|
23
|
+
while (!fs.existsSync(path.join(nodeModulesDir, 'node_modules')) && nodeModulesDir !== '/') {
|
|
24
|
+
nodeModulesDir = path.resolve(nodeModulesDir, '..');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Path to the Claude CLI file
|
|
28
|
+
const cliPath = path.join(nodeModulesDir, 'node_modules', '@anthropic-ai', 'claude-code', 'cli.mjs');
|
|
29
|
+
|
|
30
|
+
if (!fs.existsSync(cliPath)) {
|
|
31
|
+
console.error(`Error: ${cliPath} not found. Make sure @anthropic-ai/claude-code is installed.`);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Create a backup of the original file
|
|
36
|
+
const backupPath = `${cliPath}.backup`;
|
|
37
|
+
if (!fs.existsSync(backupPath)) {
|
|
38
|
+
fs.copyFileSync(cliPath, backupPath);
|
|
39
|
+
debug(`Created backup at ${backupPath}`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Read the file content
|
|
43
|
+
let cliContent = fs.readFileSync(cliPath, 'utf8');
|
|
44
|
+
|
|
45
|
+
// Replace getIsDocker() calls with true
|
|
46
|
+
cliContent = cliContent.replace(/[a-zA-Z0-9_]*\.getIsDocker\(\)/g, 'true');
|
|
47
|
+
debug("Replaced all instances of *.getIsDocker() with true");
|
|
48
|
+
|
|
49
|
+
// Replace hasInternetAccess() calls with false
|
|
50
|
+
cliContent = cliContent.replace(/[a-zA-Z0-9_]*\.hasInternetAccess\(\)/g, 'false');
|
|
51
|
+
debug("Replaced all instances of *.hasInternetAccess() with false");
|
|
52
|
+
|
|
53
|
+
// Write the modified content back
|
|
54
|
+
fs.writeFileSync(cliPath, cliContent);
|
|
55
|
+
debug("Modifications complete. The --dangerously-skip-permissions flag should now work everywhere.");
|
|
56
|
+
|
|
57
|
+
// Add the --dangerously-skip-permissions flag to the command line arguments
|
|
58
|
+
// This will ensure it's passed to the CLI even if the user didn't specify it
|
|
59
|
+
process.argv.splice(2, 0, '--dangerously-skip-permissions');
|
|
60
|
+
debug("Added --dangerously-skip-permissions flag to command line arguments");
|
|
61
|
+
|
|
62
|
+
// Now import the modified CLI
|
|
63
|
+
import('@anthropic-ai/claude-code/cli.mjs');
|
package/make-yolo.sh
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Script to modify the --dangerously-skip-permissions check in Claude Terminal
|
|
4
|
+
# This will allow the flag to work everywhere by making the Docker and internet checks always return false
|
|
5
|
+
|
|
6
|
+
# Set the path to the cli.mjs file
|
|
7
|
+
CLI_FILE="${CLAUDE_PATH:-/node_modules/@anthropic-ai/claude-code/cli.mjs}"
|
|
8
|
+
|
|
9
|
+
# Check if the file exists
|
|
10
|
+
if [ ! -f "$CLI_FILE" ]; then
|
|
11
|
+
echo "Error: $CLI_FILE not found. Make sure you're running this script from the claude-terminal root directory."
|
|
12
|
+
exit 1
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
# Create a backup of the original file
|
|
16
|
+
cp "$CLI_FILE" "${CLI_FILE}.backup"
|
|
17
|
+
echo "Created backup at ${CLI_FILE}.backup"
|
|
18
|
+
|
|
19
|
+
# Replace any object's getIsDocker() call with true
|
|
20
|
+
sed -i.bak1 's/[a-zA-Z0-9_]*\.getIsDocker()/true/g' "$CLI_FILE"
|
|
21
|
+
echo "Replaced all instances of *.getIsDocker() with true"
|
|
22
|
+
|
|
23
|
+
# Replace any object's hasInternetAccess() call with false
|
|
24
|
+
sed -i.bak2 's/[a-zA-Z0-9_]*\.hasInternetAccess()/false/g' "$CLI_FILE"
|
|
25
|
+
echo "Replaced all instances of *.hasInternetAccess() with false"
|
|
26
|
+
|
|
27
|
+
# Clean up the .bak files created by sed
|
|
28
|
+
rm -f "${CLI_FILE}.bak1" "${CLI_FILE}.bak2"
|
|
29
|
+
|
|
30
|
+
echo "Modifications complete. The --dangerously-skip-permissions flag should now work everywhere."
|
|
31
|
+
echo "To revert changes, restore from the backup file: ${CLI_FILE}.backup"
|
package/package.json
CHANGED