droid-patch 0.1.1 → 0.1.2

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.
Files changed (2) hide show
  1. package/README.md +68 -14
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -12,20 +12,36 @@ npx droid-patch --help
12
12
 
13
13
  ## Usage
14
14
 
15
- ### Patch and create an alias
15
+ ### Patch and Create an Alias
16
16
 
17
17
  ```bash
18
- # Patch the default droid binary and create an alias
19
- npx droid-patch --is-custom droid
18
+ # Patch with --is-custom and create an alias
19
+ npx droid-patch --is-custom droid-custom
20
+
21
+ # Patch with --skip-login to bypass login requirement
22
+ npx droid-patch --skip-login droid-nologin
23
+
24
+ # Combine multiple patches
25
+ npx droid-patch --is-custom --skip-login droid-patched
20
26
 
21
27
  # Specify a custom path to the droid binary
22
- npx droid-patch --is-custom -p /path/to/droid my-droid
28
+ npx droid-patch --skip-login -p /path/to/droid my-droid
23
29
 
24
30
  # Dry run - verify patches without actually applying them
25
- npx droid-patch --is-custom --dry-run droid
31
+ npx droid-patch --skip-login --dry-run droid
26
32
 
27
33
  # Verbose output
28
- npx droid-patch --is-custom -v droid
34
+ npx droid-patch --skip-login -v droid
35
+ ```
36
+
37
+ ### Output to a Specific Directory
38
+
39
+ ```bash
40
+ # Output patched binary to current directory
41
+ npx droid-patch --skip-login -o . my-droid
42
+
43
+ # Output to a specific directory
44
+ npx droid-patch --skip-login -o /path/to/dir my-droid
29
45
  ```
30
46
 
31
47
  ### Available Options
@@ -33,13 +49,14 @@ npx droid-patch --is-custom -v droid
33
49
  | Option | Description |
34
50
  |--------|-------------|
35
51
  | `--is-custom` | Patch `isCustom:!0` to `isCustom:!1` (enables context compression for custom models) |
52
+ | `--skip-login` | Bypass login by injecting a fake `FACTORY_API_KEY` into the binary |
36
53
  | `--dry-run` | Verify patches without actually modifying the binary |
37
54
  | `-p, --path <path>` | Path to the droid binary (default: `~/.droid/bin/droid`) |
38
- | `-o, --output <path>` | Output path for patched binary (default: `<path>.patched`) |
55
+ | `-o, --output <dir>` | Output directory for patched binary (creates file without alias) |
39
56
  | `--no-backup` | Skip creating backup of original binary |
40
57
  | `-v, --verbose` | Enable verbose output |
41
58
 
42
- ### Manage Aliases
59
+ ### Manage Aliases and Files
43
60
 
44
61
  ```bash
45
62
  # List all aliases
@@ -47,25 +64,36 @@ npx droid-patch list
47
64
 
48
65
  # Remove an alias
49
66
  npx droid-patch remove <alias-name>
67
+
68
+ # Remove a patched binary file by path
69
+ npx droid-patch remove ./my-droid
70
+ npx droid-patch remove /path/to/patched-binary
71
+ ```
72
+
73
+ ### Check Version
74
+
75
+ ```bash
76
+ npx droid-patch version
50
77
  ```
51
78
 
52
79
  ## PATH Configuration
53
80
 
54
- After creating an alias, you need to add the aliases directory to your PATH:
81
+ When creating an alias (without `-o`), the tool will try to install to a directory already in your PATH (like `~/.local/bin`). If not available, you need to add the aliases directory to your PATH:
55
82
 
56
83
  ```bash
57
84
  # Add to your shell config (~/.zshrc, ~/.bashrc, etc.)
58
85
  export PATH="$HOME/.droid-patch/aliases:$PATH"
59
86
  ```
60
87
 
61
- Or run the quick setup command shown after patching.
62
-
63
88
  ## How It Works
64
89
 
65
- 1. **Patching**: The tool searches for specific byte patterns in the droid binary and replaces them
66
- 2. **Alias Creation**:
90
+ 1. **Patching**: The tool searches for specific byte patterns in the droid binary and replaces them with equal-length replacements
91
+ 2. **Alias Creation** (without `-o`):
67
92
  - Copies the patched binary to `~/.droid-patch/bins/`
68
- - Creates a symlink in `~/.droid-patch/aliases/`
93
+ - Creates a symlink in a PATH directory or `~/.droid-patch/aliases/`
94
+ - On macOS, automatically re-signs the binary with `codesign`
95
+ 3. **Direct Output** (with `-o`):
96
+ - Saves the patched binary directly to the specified directory
69
97
  - On macOS, automatically re-signs the binary with `codesign`
70
98
 
71
99
  ## Available Patches
@@ -78,6 +106,32 @@ Changes `isCustom:!0` (true) to `isCustom:!1` (false) for custom models.
78
106
 
79
107
  **Note**: Side effects are unknown - test thoroughly before production use.
80
108
 
109
+ ### `--skip-login`
110
+
111
+ Replaces all `process.env.FACTORY_API_KEY` references in the binary with a hardcoded fake key `"fk-droid-patch-skip-00000"`.
112
+
113
+ **Purpose**: Bypass the login/authentication requirement without needing to set the `FACTORY_API_KEY` environment variable.
114
+
115
+ **How it works**:
116
+ - The original code checks `process.env.FACTORY_API_KEY` to authenticate
117
+ - After patching, the code directly uses the fake key string, bypassing the env check
118
+ - This is a binary-level patch, so it works across all terminal sessions without any environment setup
119
+
120
+ ## Examples
121
+
122
+ ```bash
123
+ # Quick start: create a login-free droid alias
124
+ npx droid-patch --skip-login droid
125
+
126
+ # Create a standalone patched binary in current directory
127
+ npx droid-patch --skip-login -o . my-droid
128
+ ./my-droid --version
129
+
130
+ # Clean up
131
+ npx droid-patch remove my-droid # remove alias
132
+ npx droid-patch remove ./my-droid # remove file
133
+ ```
134
+
81
135
  ## License
82
136
 
83
137
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "droid-patch",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "CLI tool to patch droid binary with various modifications",
5
5
  "homepage": "https://github.com/kingsword09/droid-patch#readme",
6
6
  "bugs": {