claude-code-termux 1.0.3 → 1.0.6
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/package.json +2 -2
- package/postinstall.js +58 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-code-termux",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Claude Code CLI with Termux/Android compatibility fixes - a wrapper that patches issues with Sharp, ripgrep, and path resolution on ARM64 Android",
|
|
5
5
|
"author": "Jimoh Ovbiagele <findingjimoh@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"test": "node scripts/verify-install.js"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@anthropic-ai/claude-code": "^2.1.
|
|
31
|
+
"@anthropic-ai/claude-code": "^2.1.7"
|
|
32
32
|
},
|
|
33
33
|
"engines": {
|
|
34
34
|
"node": ">=18.0.0 <25.0.0"
|
package/postinstall.js
CHANGED
|
@@ -170,6 +170,63 @@ function setupOAuthStorage() {
|
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
+
/**
|
|
174
|
+
* Install Sharp WASM for image support on Termux
|
|
175
|
+
* Downloads tarball directly to bypass npm platform restrictions
|
|
176
|
+
*/
|
|
177
|
+
function installSharpWasm() {
|
|
178
|
+
if (!isTermux) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
console.log('[claude-code-termux] Installing Sharp WASM for image support...');
|
|
183
|
+
|
|
184
|
+
const nodeModulesDir = path.join(__dirname, 'node_modules', '@img');
|
|
185
|
+
const sharpWasmDir = path.join(nodeModulesDir, 'sharp-wasm32');
|
|
186
|
+
|
|
187
|
+
// Check if already installed
|
|
188
|
+
if (fs.existsSync(path.join(sharpWasmDir, 'package.json'))) {
|
|
189
|
+
console.log('[claude-code-termux] Sharp WASM already installed');
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
try {
|
|
194
|
+
// Create directory structure
|
|
195
|
+
if (!fs.existsSync(nodeModulesDir)) {
|
|
196
|
+
fs.mkdirSync(nodeModulesDir, { recursive: true });
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Download tarball directly (bypasses npm platform checks)
|
|
200
|
+
const tarballUrl = 'https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.34.5.tgz';
|
|
201
|
+
const tmpTar = path.join(__dirname, 'sharp-wasm32.tgz');
|
|
202
|
+
|
|
203
|
+
console.log('[claude-code-termux] Downloading Sharp WASM from npm registry...');
|
|
204
|
+
execSync(`curl -sL "${tarballUrl}" -o "${tmpTar}"`, { stdio: 'inherit' });
|
|
205
|
+
|
|
206
|
+
// Extract to node_modules/@img/sharp-wasm32
|
|
207
|
+
// npm tarballs have a 'package/' prefix inside
|
|
208
|
+
execSync(`tar -xzf "${tmpTar}" -C "${nodeModulesDir}"`, { stdio: 'inherit' });
|
|
209
|
+
|
|
210
|
+
// Rename 'package' to 'sharp-wasm32'
|
|
211
|
+
const extractedDir = path.join(nodeModulesDir, 'package');
|
|
212
|
+
if (fs.existsSync(extractedDir)) {
|
|
213
|
+
if (fs.existsSync(sharpWasmDir)) {
|
|
214
|
+
fs.rmSync(sharpWasmDir, { recursive: true, force: true });
|
|
215
|
+
}
|
|
216
|
+
fs.renameSync(extractedDir, sharpWasmDir);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Cleanup
|
|
220
|
+
fs.unlinkSync(tmpTar);
|
|
221
|
+
|
|
222
|
+
console.log('[claude-code-termux] Sharp WASM installed successfully');
|
|
223
|
+
} catch (err) {
|
|
224
|
+
console.error('[claude-code-termux] Failed to install Sharp WASM:', err.message);
|
|
225
|
+
console.log('[claude-code-termux] Image reading may not work. You can try manually:');
|
|
226
|
+
console.log(' curl -sL https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.34.5.tgz | tar -xz -C node_modules/@img/ && mv node_modules/@img/package node_modules/@img/sharp-wasm32');
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
173
230
|
/**
|
|
174
231
|
* Main setup function
|
|
175
232
|
*/
|
|
@@ -188,13 +245,13 @@ function main() {
|
|
|
188
245
|
setupRipgrep(claudeCodePath);
|
|
189
246
|
copyLinuxBinariesAsAndroidFallback(claudeCodePath);
|
|
190
247
|
setupOAuthStorage();
|
|
248
|
+
installSharpWasm();
|
|
191
249
|
}
|
|
192
250
|
|
|
193
251
|
console.log('[claude-code-termux] Post-install complete!');
|
|
194
252
|
|
|
195
253
|
if (isTermux) {
|
|
196
254
|
console.log('\n[claude-code-termux] Termux setup tips:');
|
|
197
|
-
console.log(' - If you encounter Sharp errors, run: npm install @img/sharp-wasm32 --force');
|
|
198
255
|
console.log(' - If you encounter ripgrep errors, run: pkg install ripgrep');
|
|
199
256
|
console.log(' - Use API key auth: export ANTHROPIC_API_KEY=your-key');
|
|
200
257
|
console.log('\nRun "claude" to start Claude Code!');
|