claude-yolo 1.3.1 → 1.4.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 CHANGED
@@ -8,6 +8,8 @@ A wrapper for the Claude CLI that always enables danger mode by bypassing Docker
8
8
  npm install -g claude-yolo
9
9
  ```
10
10
 
11
+ GitHub: [https://github.com/eastlondoner/claude-yolo](https://github.com/eastlondoner/claude-yolo)
12
+
11
13
  ## Usage
12
14
 
13
15
  ```bash
@@ -17,17 +19,19 @@ claude-yolo [options]
17
19
  All arguments and options are passed directly to the Claude CLI.
18
20
 
19
21
  This wrapper:
20
- 1. Prints "YOLO" to the console
21
- 2. Creates a modified copy of the Claude CLI code to bypass permission checks
22
+ 1. Checks for and automatically installs updates to the Claude package
23
+ 2. Prints "YOLO" to the console
24
+ 3. Creates a modified copy of the Claude CLI code to bypass permission checks
22
25
  - Replaces all `getIsDocker()` calls with `true`
23
26
  - Replaces all `hasInternetAccess()` calls with `false`
24
- 3. Leaves the original Claude CLI file untouched (won't affect your normal `claude` command)
25
- 4. Adds the `--dangerously-skip-permissions` flag to command line arguments
26
- 5. Imports the modified copy of the CLI
27
+ 4. Leaves the original Claude CLI file untouched (won't affect your normal `claude` command)
28
+ 5. Adds the `--dangerously-skip-permissions` flag to command line arguments
29
+ 6. Imports the modified copy of the CLI
27
30
 
28
- ## New in Version 1.3.0
31
+ ## New in Version 1.4.0
29
32
 
30
- - **Non-destructive approach**: Now creates a separate modified copy of the CLI file instead of modifying the original
33
+ - **Auto-update**: Automatically checks for and installs updates to the Claude package at runtime
34
+ - **Non-destructive approach**: Creates a separate modified copy of the CLI file instead of modifying the original
31
35
  - **Safe for global installations**: Your regular `claude` command will work normally even after installing claude-yolo
32
36
  - **Debug mode**: Set the `DEBUG=1` environment variable to see detailed logs about the modifications
33
37
 
@@ -43,6 +47,23 @@ If you encounter any issues, you can run with debug output:
43
47
  DEBUG=1 claude-yolo
44
48
  ```
45
49
 
50
+ This will show additional information about:
51
+ - Claude package update checks
52
+ - Current and latest available versions
53
+ - When updates are being installed
54
+ - Modifications being made to the CLI file
55
+
56
+ ## Auto-Update Feature
57
+
58
+ Claude YOLO automatically checks for updates to the Claude package each time it runs:
59
+
60
+ 1. When you run `claude-yolo`, it checks for the latest version of `@anthropic-ai/claude-code` on npm
61
+ 2. If your installed version is outdated, it will:
62
+ - Update your package.json with the latest version
63
+ - Run npm install to get the newest version
64
+ - Notify you that an update was applied
65
+ 3. This ensures you're always using the latest Claude CLI features
66
+
46
67
  ## Disclaimer
47
68
 
48
69
  This is an unofficial tool and not supported by Anthropic. Use at your own risk.
@@ -6,6 +6,7 @@ import fs from 'fs';
6
6
  import path from 'path';
7
7
  import { createRequire } from 'module';
8
8
  import { fileURLToPath } from 'url';
9
+ import { execSync } from 'child_process';
9
10
 
10
11
  // Debug logging function that only logs if DEBUG env var is set
11
12
  const debug = (message) => {
@@ -24,11 +25,57 @@ while (!fs.existsSync(path.join(nodeModulesDir, 'node_modules')) && nodeModulesD
24
25
  nodeModulesDir = path.resolve(nodeModulesDir, '..');
25
26
  }
26
27
 
28
+ // Path to check package info
29
+ const packageJsonPath = path.join(nodeModulesDir, 'package.json');
30
+
31
+ // Check for updates to Claude package
32
+ async function checkForUpdates() {
33
+ try {
34
+ debug("Checking for Claude package updates...");
35
+
36
+ // Get the latest version available on npm
37
+ const latestVersionCmd = "npm view @anthropic-ai/claude-code version";
38
+ const latestVersion = execSync(latestVersionCmd).toString().trim();
39
+ debug(`Latest Claude version on npm: ${latestVersion}`);
40
+
41
+ // Get our current installed version
42
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
43
+ const dependencies = packageJson.dependencies || {};
44
+ const currentVersion = dependencies['@anthropic-ai/claude-code'];
45
+
46
+ debug(`Current dependency in package.json: ${currentVersion}`);
47
+
48
+ // If using a specific version (not "latest"), and it's out of date, update
49
+ if (currentVersion !== "latest" && currentVersion !== latestVersion) {
50
+ console.log(`Updating Claude package from ${currentVersion || 'unknown'} to ${latestVersion}...`);
51
+
52
+ // Update package.json
53
+ packageJson.dependencies['@anthropic-ai/claude-code'] = latestVersion;
54
+ fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
55
+
56
+ // Run npm install
57
+ console.log("Running npm install to update dependencies...");
58
+ execSync("npm install", { stdio: 'inherit', cwd: nodeModulesDir });
59
+ console.log("Update complete!");
60
+ } else if (currentVersion === "latest") {
61
+ // If using "latest", just make sure we have the latest version installed
62
+ debug("Using 'latest' tag in package.json, running npm install to ensure we have the newest version");
63
+ execSync("npm install", { stdio: 'inherit', cwd: nodeModulesDir });
64
+ }
65
+ } catch (error) {
66
+ console.error("Error checking for updates:", error.message);
67
+ debug(error.stack);
68
+ }
69
+ }
70
+
27
71
  // Path to the Claude CLI file
28
72
  const claudeDir = path.join(nodeModulesDir, 'node_modules', '@anthropic-ai', 'claude-code');
29
73
  const originalCliPath = path.join(claudeDir, 'cli.mjs');
30
74
  const yoloCliPath = path.join(claudeDir, 'cli-yolo.mjs');
31
75
 
76
+ // Check and update Claude package first
77
+ await checkForUpdates();
78
+
32
79
  if (!fs.existsSync(originalCliPath)) {
33
80
  console.error(`Error: ${originalCliPath} not found. Make sure @anthropic-ai/claude-code is installed.`);
34
81
  process.exit(1);
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "claude-yolo",
3
- "version": "1.3.1",
4
- "description": "YOLO wrapper for Claude CLI with danger mode always enabled",
3
+ "version": "1.4.0",
4
+ "description": "YOLO wrapper for Claude CLI with danger mode always enabled and auto-updates",
5
5
  "bin": {
6
6
  "claude-yolo": "./bin/claude-yolo.js"
7
7
  },
8
8
  "dependencies": {
9
- "@anthropic-ai/claude-code": "latest"
9
+ "@anthropic-ai/claude-code": "0.2.14"
10
10
  },
11
11
  "type": "module"
12
12
  }