claude-yolo 1.2.0 → 1.3.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 +3 -3
- package/bin/claude-yolo.js +11 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,12 +18,12 @@ All arguments and options are passed directly to the Claude CLI.
|
|
|
18
18
|
|
|
19
19
|
This wrapper:
|
|
20
20
|
1. Prints "YOLO" to the console
|
|
21
|
-
2.
|
|
21
|
+
2. Creates a modified copy of the Claude CLI code to bypass permission checks
|
|
22
22
|
- Replaces all `getIsDocker()` calls with `true`
|
|
23
23
|
- Replaces all `hasInternetAccess()` calls with `false`
|
|
24
|
-
3.
|
|
24
|
+
3. Leaves the original Claude CLI file untouched
|
|
25
25
|
4. Adds the `--dangerously-skip-permissions` flag to command line arguments
|
|
26
|
-
5. Imports the modified CLI
|
|
26
|
+
5. Imports the modified copy of the CLI
|
|
27
27
|
|
|
28
28
|
## Why?
|
|
29
29
|
|
package/bin/claude-yolo.js
CHANGED
|
@@ -25,22 +25,17 @@ while (!fs.existsSync(path.join(nodeModulesDir, 'node_modules')) && nodeModulesD
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
// Path to the Claude CLI file
|
|
28
|
-
const
|
|
28
|
+
const claudeDir = path.join(nodeModulesDir, 'node_modules', '@anthropic-ai', 'claude-code');
|
|
29
|
+
const originalCliPath = path.join(claudeDir, 'cli.mjs');
|
|
30
|
+
const yoloCliPath = path.join(claudeDir, 'cli-yolo.mjs');
|
|
29
31
|
|
|
30
|
-
if (!fs.existsSync(
|
|
31
|
-
console.error(`Error: ${
|
|
32
|
+
if (!fs.existsSync(originalCliPath)) {
|
|
33
|
+
console.error(`Error: ${originalCliPath} not found. Make sure @anthropic-ai/claude-code is installed.`);
|
|
32
34
|
process.exit(1);
|
|
33
35
|
}
|
|
34
36
|
|
|
35
|
-
//
|
|
36
|
-
|
|
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');
|
|
37
|
+
// Read the original CLI file content
|
|
38
|
+
let cliContent = fs.readFileSync(originalCliPath, 'utf8');
|
|
44
39
|
|
|
45
40
|
// Replace getIsDocker() calls with true
|
|
46
41
|
cliContent = cliContent.replace(/[a-zA-Z0-9_]*\.getIsDocker\(\)/g, 'true');
|
|
@@ -50,8 +45,9 @@ debug("Replaced all instances of *.getIsDocker() with true");
|
|
|
50
45
|
cliContent = cliContent.replace(/[a-zA-Z0-9_]*\.hasInternetAccess\(\)/g, 'false');
|
|
51
46
|
debug("Replaced all instances of *.hasInternetAccess() with false");
|
|
52
47
|
|
|
53
|
-
// Write the modified content
|
|
54
|
-
fs.writeFileSync(
|
|
48
|
+
// Write the modified content to a new file, leaving the original untouched
|
|
49
|
+
fs.writeFileSync(yoloCliPath, cliContent);
|
|
50
|
+
debug(`Created modified CLI at ${yoloCliPath}`);
|
|
55
51
|
debug("Modifications complete. The --dangerously-skip-permissions flag should now work everywhere.");
|
|
56
52
|
|
|
57
53
|
// Add the --dangerously-skip-permissions flag to the command line arguments
|
|
@@ -60,4 +56,4 @@ process.argv.splice(2, 0, '--dangerously-skip-permissions');
|
|
|
60
56
|
debug("Added --dangerously-skip-permissions flag to command line arguments");
|
|
61
57
|
|
|
62
58
|
// Now import the modified CLI
|
|
63
|
-
import(
|
|
59
|
+
import(yoloCliPath);
|