@mmmbuto/gemini-cli-termux 0.22.7-termux → 0.24.0-termux
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 +17 -21
- package/bundle/docs/TERMUX.md +97 -0
- package/bundle/docs/architecture.md +80 -0
- package/bundle/docs/assets/connected_devtools.png +0 -0
- package/bundle/docs/assets/gemini-screenshot.png +0 -0
- package/bundle/docs/assets/release_patch.png +0 -0
- package/bundle/docs/assets/theme-ansi-light.png +0 -0
- package/bundle/docs/assets/theme-ansi.png +0 -0
- package/bundle/docs/assets/theme-atom-one.png +0 -0
- package/bundle/docs/assets/theme-ayu-light.png +0 -0
- package/bundle/docs/assets/theme-ayu.png +0 -0
- package/bundle/docs/assets/theme-custom.png +0 -0
- package/bundle/docs/assets/theme-default-light.png +0 -0
- package/bundle/docs/assets/theme-default.png +0 -0
- package/bundle/docs/assets/theme-dracula.png +0 -0
- package/bundle/docs/assets/theme-github-light.png +0 -0
- package/bundle/docs/assets/theme-github.png +0 -0
- package/bundle/docs/assets/theme-google-light.png +0 -0
- package/bundle/docs/assets/theme-xcode-light.png +0 -0
- package/bundle/docs/changelogs/index.md +592 -0
- package/bundle/docs/changelogs/latest.md +225 -0
- package/bundle/docs/changelogs/preview.md +129 -0
- package/bundle/docs/changelogs/releases.md +896 -0
- package/bundle/docs/cli/authentication.md +3 -0
- package/bundle/docs/cli/checkpointing.md +94 -0
- package/bundle/docs/cli/commands.md +354 -0
- package/bundle/docs/cli/configuration.md +792 -0
- package/bundle/docs/cli/context-memory.md +69 -0
- package/bundle/docs/cli/custom-commands.md +315 -0
- package/bundle/docs/cli/enterprise.md +565 -0
- package/bundle/docs/cli/gemini-ignore.md +71 -0
- package/bundle/docs/cli/gemini-md.md +108 -0
- package/bundle/docs/cli/generation-settings.md +210 -0
- package/bundle/docs/cli/headless.md +388 -0
- package/bundle/docs/cli/index.md +63 -0
- package/bundle/docs/cli/keyboard-shortcuts.md +143 -0
- package/bundle/docs/cli/model-routing.md +37 -0
- package/bundle/docs/cli/model.md +62 -0
- package/bundle/docs/cli/sandbox.md +171 -0
- package/bundle/docs/cli/session-management.md +158 -0
- package/bundle/docs/cli/settings.md +114 -0
- package/bundle/docs/cli/system-prompt.md +93 -0
- package/bundle/docs/cli/telemetry.md +791 -0
- package/bundle/docs/cli/themes.md +237 -0
- package/bundle/docs/cli/token-caching.md +20 -0
- package/bundle/docs/cli/trusted-folders.md +95 -0
- package/bundle/docs/cli/tutorials.md +83 -0
- package/bundle/docs/cli/uninstall.md +47 -0
- package/bundle/docs/core/index.md +101 -0
- package/bundle/docs/core/memport.md +244 -0
- package/bundle/docs/core/policy-engine.md +267 -0
- package/bundle/docs/core/tools-api.md +131 -0
- package/bundle/docs/examples/proxy-script.md +83 -0
- package/bundle/docs/extensions/extension-releasing.md +183 -0
- package/bundle/docs/extensions/getting-started-extensions.md +245 -0
- package/bundle/docs/extensions/index.md +293 -0
- package/bundle/docs/faq.md +154 -0
- package/bundle/docs/get-started/authentication.md +321 -0
- package/bundle/docs/get-started/configuration-v1.md +888 -0
- package/bundle/docs/get-started/configuration.md +1511 -0
- package/bundle/docs/get-started/deployment.md +143 -0
- package/bundle/docs/get-started/examples.md +219 -0
- package/bundle/docs/get-started/gemini-3.md +116 -0
- package/bundle/docs/get-started/index.md +71 -0
- package/bundle/docs/get-started/installation.md +141 -0
- package/bundle/docs/hooks/best-practices.md +806 -0
- package/bundle/docs/hooks/index.md +665 -0
- package/bundle/docs/hooks/reference.md +168 -0
- package/bundle/docs/hooks/writing-hooks.md +1026 -0
- package/bundle/docs/ide-integration/ide-companion-spec.md +267 -0
- package/bundle/docs/ide-integration/index.md +202 -0
- package/bundle/docs/index.md +147 -0
- package/bundle/docs/integration-tests.md +211 -0
- package/bundle/docs/issue-and-pr-automation.md +134 -0
- package/bundle/docs/local-development.md +128 -0
- package/bundle/docs/mermaid/context.mmd +103 -0
- package/bundle/docs/mermaid/render-path.mmd +64 -0
- package/bundle/docs/npm.md +62 -0
- package/bundle/docs/patches/CONTEXT_MEMORY_COMPARISON.md +306 -0
- package/bundle/docs/patches/MERGE_TO_0.24_ANALYSIS.md +321 -0
- package/bundle/docs/patches/README.md +62 -0
- package/bundle/docs/quota-and-pricing.md +158 -0
- package/bundle/docs/release-confidence.md +164 -0
- package/bundle/docs/releases.md +540 -0
- package/bundle/docs/sidebar.json +297 -0
- package/bundle/docs/termux-api/COMMANDS.md +592 -0
- package/bundle/docs/termux-api/DISCOVERY_SETUP.md +670 -0
- package/bundle/docs/termux-api/EXECUTION_PLAN.md +532 -0
- package/bundle/docs/termux-api/MERGE_STRATEGY.md +325 -0
- package/bundle/docs/termux-api/PATCHES.md +483 -0
- package/bundle/docs/termux-api/README.md +416 -0
- package/bundle/docs/tools/file-system.md +217 -0
- package/bundle/docs/tools/index.md +95 -0
- package/bundle/docs/tools/mcp-server.md +1044 -0
- package/bundle/docs/tools/memory.md +54 -0
- package/bundle/docs/tools/shell.md +260 -0
- package/bundle/docs/tools/todos.md +57 -0
- package/bundle/docs/tools/web-fetch.md +59 -0
- package/bundle/docs/tools/web-search.md +42 -0
- package/bundle/docs/tos-privacy.md +96 -0
- package/bundle/docs/troubleshooting.md +158 -0
- package/bundle/gemini.js +8901 -6534
- package/package.json +10 -8
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
# Patch Analysis & Improvement Proposals
|
|
2
|
+
|
|
3
|
+
**Project**: gemini-cli-termux **Version**: 0.22.0-termux **Author**: DioNanos
|
|
4
|
+
**Date**: 2025-12-17
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Executive Summary
|
|
9
|
+
|
|
10
|
+
This document analyzes the current patches of the Termux fork and proposes
|
|
11
|
+
improvements for installation and user experience.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Current Patches
|
|
16
|
+
|
|
17
|
+
### 1. Clipboard TERMUX\_\_PREFIX
|
|
18
|
+
|
|
19
|
+
**File**: `esbuild.config.js` (lines 80-81)
|
|
20
|
+
|
|
21
|
+
```javascript
|
|
22
|
+
// Termux compatibility: clipboardy expects TERMUX__PREFIX but Termux sets PREFIX
|
|
23
|
+
if (
|
|
24
|
+
process.platform === 'android' &&
|
|
25
|
+
process.env.PREFIX &&
|
|
26
|
+
!process.env.TERMUX__PREFIX
|
|
27
|
+
) {
|
|
28
|
+
process.env.TERMUX__PREFIX = process.env.PREFIX;
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Purpose**: clipboardy uses `TERMUX__PREFIX` to detect Termux, but Termux sets
|
|
33
|
+
`PREFIX`.
|
|
34
|
+
|
|
35
|
+
**Status**: ✅ Functional
|
|
36
|
+
|
|
37
|
+
**Proposed Improvements**:
|
|
38
|
+
|
|
39
|
+
- Add `TERMUX_VERSION` check for better robustness
|
|
40
|
+
- Consider contributing to upstream clipboardy
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
### 2. is-in-ci Override
|
|
45
|
+
|
|
46
|
+
**File**: `packages/cli/src/patches/is-in-ci.ts`
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
// This is a replacement for the `is-in-ci` package that always returns false.
|
|
50
|
+
// We are doing this to avoid the issue where `ink` does not render the UI
|
|
51
|
+
// when it detects that it is running in a CI environment.
|
|
52
|
+
|
|
53
|
+
const isInCi = false;
|
|
54
|
+
export default isInCi;
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Purpose**: Termux might be incorrectly detected as CI, disabling Ink UI.
|
|
58
|
+
|
|
59
|
+
**Status**: ✅ Functional
|
|
60
|
+
|
|
61
|
+
**Proposed Improvements**:
|
|
62
|
+
|
|
63
|
+
- Add debug log when override is active
|
|
64
|
+
- Better document the behavior
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
### 3. Native Modules Optional
|
|
69
|
+
|
|
70
|
+
**File**: `package.json`
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"optionalDependencies": {
|
|
75
|
+
"@lydell/node-pty": "1.1.0",
|
|
76
|
+
"@lydell/node-pty-darwin-arm64": "1.1.0",
|
|
77
|
+
"@lydell/node-pty-darwin-x64": "1.1.0",
|
|
78
|
+
"@lydell/node-pty-linux-x64": "1.1.0",
|
|
79
|
+
"@lydell/node-pty-win32-arm64": "1.1.0",
|
|
80
|
+
"@lydell/node-pty-win32-x64": "1.1.0",
|
|
81
|
+
"node-pty": "^1.0.0"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Purpose**: Allows installation without compiling native modules.
|
|
87
|
+
|
|
88
|
+
**Status**: ✅ Functional, but with warnings
|
|
89
|
+
|
|
90
|
+
**Proposed Improvements**: See
|
|
91
|
+
[Installation Improvements](#installation-improvements)
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
### 4. esbuild External Modules
|
|
96
|
+
|
|
97
|
+
**File**: `esbuild.config.js`
|
|
98
|
+
|
|
99
|
+
```javascript
|
|
100
|
+
const external = [
|
|
101
|
+
'@lydell/node-pty',
|
|
102
|
+
'node-pty',
|
|
103
|
+
'@lydell/node-pty-darwin-arm64',
|
|
104
|
+
'@lydell/node-pty-darwin-x64',
|
|
105
|
+
'@lydell/node-pty-linux-x64',
|
|
106
|
+
'@lydell/node-pty-win32-arm64',
|
|
107
|
+
'@lydell/node-pty-win32-x64',
|
|
108
|
+
];
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Purpose**: Excludes native modules from the bundle.
|
|
112
|
+
|
|
113
|
+
**Status**: ✅ Functional
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Installation Improvements
|
|
118
|
+
|
|
119
|
+
### Issue 1: Warning during npm install
|
|
120
|
+
|
|
121
|
+
**Symptom**:
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
npm warn optional SKIPPING OPTIONAL DEPENDENCY: @lydell/node-pty@1.1.0
|
|
125
|
+
npm warn notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @lydell/node-pty-linux-x64
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Proposed Solution**:
|
|
129
|
+
|
|
130
|
+
#### A. Custom postinstall script
|
|
131
|
+
|
|
132
|
+
```javascript
|
|
133
|
+
// scripts/postinstall.js
|
|
134
|
+
const os = require('os');
|
|
135
|
+
|
|
136
|
+
if (os.platform() === 'android' || process.env.TERMUX_VERSION) {
|
|
137
|
+
console.log('');
|
|
138
|
+
console.log(
|
|
139
|
+
'╔══════════════════════════════════════════════════════════════╗',
|
|
140
|
+
);
|
|
141
|
+
console.log(
|
|
142
|
+
'║ gemini-cli-termux installed successfully! ║',
|
|
143
|
+
);
|
|
144
|
+
console.log(
|
|
145
|
+
'║ ║',
|
|
146
|
+
);
|
|
147
|
+
console.log(
|
|
148
|
+
'║ Note: Native module warnings above are EXPECTED on Termux. ║',
|
|
149
|
+
);
|
|
150
|
+
console.log(
|
|
151
|
+
'║ The CLI will work with reduced PTY functionality. ║',
|
|
152
|
+
);
|
|
153
|
+
console.log(
|
|
154
|
+
'║ ║',
|
|
155
|
+
);
|
|
156
|
+
console.log(
|
|
157
|
+
'║ Run: gemini --version ║',
|
|
158
|
+
);
|
|
159
|
+
console.log(
|
|
160
|
+
'╚══════════════════════════════════════════════════════════════╝',
|
|
161
|
+
);
|
|
162
|
+
console.log('');
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Modify package.json**:
|
|
167
|
+
|
|
168
|
+
```json
|
|
169
|
+
{
|
|
170
|
+
"scripts": {
|
|
171
|
+
"postinstall": "node scripts/postinstall.js || true"
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
#### B. Documentation .npmrc
|
|
177
|
+
|
|
178
|
+
Create `.npmrc` with:
|
|
179
|
+
|
|
180
|
+
```ini
|
|
181
|
+
# Suppress optional dependency warnings
|
|
182
|
+
loglevel=error
|
|
183
|
+
optional=false
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
**Note**: Not recommended globally, but useful for advanced users.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
### Issue 2: Build from source requires manual flags
|
|
191
|
+
|
|
192
|
+
**Symptom**: Users must remember `--ignore-optional --ignore-scripts`.
|
|
193
|
+
|
|
194
|
+
**Proposed Solution**:
|
|
195
|
+
|
|
196
|
+
#### A. Improved Makefile
|
|
197
|
+
|
|
198
|
+
```makefile
|
|
199
|
+
# Makefile
|
|
200
|
+
|
|
201
|
+
.PHONY: install build clean termux-install
|
|
202
|
+
|
|
203
|
+
# Standard install (desktop)
|
|
204
|
+
install:
|
|
205
|
+
nnpm install
|
|
206
|
+
|
|
207
|
+
# Termux-specific install
|
|
208
|
+
termux-install:
|
|
209
|
+
@echo "Installing for Termux..."
|
|
210
|
+
npm install --ignore-optional --ignore-scripts
|
|
211
|
+
npm run build
|
|
212
|
+
npm run bundle
|
|
213
|
+
@echo ""
|
|
214
|
+
@echo "Installation complete! Run: node bundle/gemini.js"
|
|
215
|
+
|
|
216
|
+
# Build only
|
|
217
|
+
build:
|
|
218
|
+
npm run build
|
|
219
|
+
npm run bundle
|
|
220
|
+
|
|
221
|
+
# Clean
|
|
222
|
+
clean:
|
|
223
|
+
rm -rf node_modules bundle/gemini.js
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
#### B. Helper script
|
|
227
|
+
|
|
228
|
+
**File**: `scripts/termux-setup.sh`
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
#!/data/data/com.termux/files/usr/bin/bash
|
|
232
|
+
|
|
233
|
+
echo "=== Gemini CLI Termux Setup ==="
|
|
234
|
+
|
|
235
|
+
# Check Node version
|
|
236
|
+
NODE_VERSION=$(node -v | cut -d'v' -f2 | cut -d'.' -f1)
|
|
237
|
+
if [ "$NODE_VERSION" -lt 20 ]; then
|
|
238
|
+
echo "Error: Node.js 20+ required. Install with: pkg install nodejs-lts"
|
|
239
|
+
exit 1
|
|
240
|
+
fi
|
|
241
|
+
|
|
242
|
+
# Install dependencies
|
|
243
|
+
echo "Installing dependencies..."
|
|
244
|
+
npm install --ignore-optional --ignore-scripts 2>&1 | grep -v "npm warn"
|
|
245
|
+
|
|
246
|
+
# Build
|
|
247
|
+
echo "Building..."
|
|
248
|
+
npm run build
|
|
249
|
+
npm run bundle
|
|
250
|
+
|
|
251
|
+
echo ""
|
|
252
|
+
|
|
253
|
+
echo "=== Setup Complete ==="
|
|
254
|
+
echo "Run: node bundle/gemini.js"
|
|
255
|
+
echo "Or link globally: npm link"
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
### Issue 3: Slow first run
|
|
261
|
+
|
|
262
|
+
**Symptom**: First run of `gemini` has delay for auth/setup.
|
|
263
|
+
|
|
264
|
+
**Proposed Solution**:
|
|
265
|
+
|
|
266
|
+
#### A. Termux-aware Configuration
|
|
267
|
+
|
|
268
|
+
**File**: `packages/core/src/config/termux-defaults.ts`
|
|
269
|
+
|
|
270
|
+
```typescript
|
|
271
|
+
export const TERMUX_DEFAULTS = {
|
|
272
|
+
// Disable PTY by default on Termux
|
|
273
|
+
enableInteractiveShell: false,
|
|
274
|
+
|
|
275
|
+
// Use file-based credential storage
|
|
276
|
+
credentialStorage: 'file',
|
|
277
|
+
|
|
278
|
+
// Reduce telemetry overhead
|
|
279
|
+
telemetryEnabled: false,
|
|
280
|
+
|
|
281
|
+
// Termux-specific paths
|
|
282
|
+
configDir: process.env.HOME + '/.config/gemini',
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
export function isTermux(): boolean {
|
|
286
|
+
return (
|
|
287
|
+
process.platform === 'android' ||
|
|
288
|
+
!!process.env.TERMUX_VERSION ||
|
|
289
|
+
!!process.env.PREFIX?.includes('com.termux')
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
### Issue 4: Manual updates
|
|
297
|
+
|
|
298
|
+
**Symptom**: Users must manually check for new versions.
|
|
299
|
+
|
|
300
|
+
**Proposed Solution**:
|
|
301
|
+
|
|
302
|
+
#### A. Optional Update Checker
|
|
303
|
+
|
|
304
|
+
```typescript
|
|
305
|
+
// packages/cli/src/utils/update-check.ts
|
|
306
|
+
import { getLatestVersion } from 'latest-version';
|
|
307
|
+
|
|
308
|
+
export async function checkForUpdates(currentVersion: string): Promise<void> {
|
|
309
|
+
if (process.env.GEMINI_SKIP_UPDATE_CHECK) return;
|
|
310
|
+
|
|
311
|
+
try {
|
|
312
|
+
const latest = await getLatestVersion('@mmmbuto/gemini-cli-termux');
|
|
313
|
+
if (latest !== currentVersion) {
|
|
314
|
+
console.log(`\n📦 Update available: ${currentVersion} → ${latest}`);
|
|
315
|
+
console.log(' Run: npm install -g @mmmbuto/gemini-cli-termux@latest\n');
|
|
316
|
+
}
|
|
317
|
+
} catch {
|
|
318
|
+
// Silently fail - network may be unavailable
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## New Proposed Patches
|
|
326
|
+
|
|
327
|
+
### Patch 5: Termux-API Detection
|
|
328
|
+
|
|
329
|
+
**Purpose**: Automatically detect if Termux-API is installed.
|
|
330
|
+
|
|
331
|
+
**Implementation**:
|
|
332
|
+
|
|
333
|
+
```typescript
|
|
334
|
+
// packages/core/src/utils/termux-detect.ts
|
|
335
|
+
import { execSync } from 'child_process';
|
|
336
|
+
|
|
337
|
+
export interface TermuxEnvironment {
|
|
338
|
+
isTermux: boolean;
|
|
339
|
+
hasTermuxApi: boolean;
|
|
340
|
+
apiVersion?: string;
|
|
341
|
+
prefix: string;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
export function detectTermuxEnvironment(): TermuxEnvironment {
|
|
345
|
+
const isTermux =
|
|
346
|
+
process.platform === 'android' ||
|
|
347
|
+
!!process.env.TERMUX_VERSION ||
|
|
348
|
+
!!process.env.PREFIX?.includes('com.termux');
|
|
349
|
+
|
|
350
|
+
if (!isTermux) {
|
|
351
|
+
return { isTermux: false, hasTermuxApi: false, prefix: '' };
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
let hasTermuxApi = false;
|
|
355
|
+
let apiVersion: string | undefined;
|
|
356
|
+
|
|
357
|
+
try {
|
|
358
|
+
execSync('which termux-battery-status', { stdio: 'ignore' });
|
|
359
|
+
hasTermuxApi = true;
|
|
360
|
+
|
|
361
|
+
// Try to get version from package
|
|
362
|
+
const result = execSync('pkg show termux-api 2>/dev/null | grep Version', {
|
|
363
|
+
encoding: 'utf-8',
|
|
364
|
+
});
|
|
365
|
+
apiVersion = result.split(':')[1]?.trim();
|
|
366
|
+
} catch {
|
|
367
|
+
// termux-api not installed
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
return {
|
|
371
|
+
isTermux: true,
|
|
372
|
+
hasTermuxApi,
|
|
373
|
+
apiVersion,
|
|
374
|
+
prefix: process.env.PREFIX || '/data/data/com.termux/files/usr',
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
### Patch 6: Suppress Harmless Warnings
|
|
382
|
+
|
|
383
|
+
**Purpose**: Hide irrelevant warnings on Termux.
|
|
384
|
+
|
|
385
|
+
**Implementation**:
|
|
386
|
+
|
|
387
|
+
```javascript
|
|
388
|
+
// In esbuild banner
|
|
389
|
+
if (process.platform === 'android') {
|
|
390
|
+
// Suppress punycode deprecation warning
|
|
391
|
+
const originalEmit = process.emit;
|
|
392
|
+
process.emit = function (name, data, ...args) {
|
|
393
|
+
if (
|
|
394
|
+
name === 'warning' &&
|
|
395
|
+
typeof data === 'object' &&
|
|
396
|
+
data.name === 'DeprecationWarning' &&
|
|
397
|
+
data.message?.includes('punycode')
|
|
398
|
+
) {
|
|
399
|
+
return false;
|
|
400
|
+
}
|
|
401
|
+
return originalEmit.apply(process, arguments);
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
408
|
+
### Patch 7: Graceful Fallback Messages
|
|
409
|
+
|
|
410
|
+
**Purpose**: User-friendly messages when features are unavailable.
|
|
411
|
+
|
|
412
|
+
**Implementation**:
|
|
413
|
+
|
|
414
|
+
```typescript
|
|
415
|
+
// packages/core/src/utils/termux-fallbacks.ts
|
|
416
|
+
export const TERMUX_FALLBACK_MESSAGES = {
|
|
417
|
+
'node-pty': 'PTY support disabled on Termux. Using basic shell mode.',
|
|
418
|
+
keytar: 'Secure keychain unavailable. Credentials stored in config file.',
|
|
419
|
+
'tree-sitter-bash':
|
|
420
|
+
'Bash parsing simplified. Some syntax highlighting limited.',
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
export function logFallbackOnce(module: string): void {
|
|
424
|
+
const key = `GEMINI_LOGGED_${module.toUpperCase()}`;
|
|
425
|
+
if (process.env[key]) return;
|
|
426
|
+
|
|
427
|
+
const message = TERMUX_FALLBACK_MESSAGES[module];
|
|
428
|
+
if (message) {
|
|
429
|
+
console.log(`ℹ️ ${message}`);
|
|
430
|
+
process.env[key] = '1';
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
---
|
|
436
|
+
|
|
437
|
+
## Patch Roadmap
|
|
438
|
+
|
|
439
|
+
### Phase 1: Quick Wins (v0.22.1)
|
|
440
|
+
|
|
441
|
+
- [ ] Add postinstall script with clear message
|
|
442
|
+
- [ ] Create termux-setup.sh helper
|
|
443
|
+
- [ ] Improve Makefile
|
|
444
|
+
|
|
445
|
+
### Phase 2: Polish (v0.23.0)
|
|
446
|
+
|
|
447
|
+
- [ ] Implement Termux detection
|
|
448
|
+
- [ ] Add update checker
|
|
449
|
+
- [ ] Suppress punycode warning
|
|
450
|
+
|
|
451
|
+
### Phase 3: Integration (v0.24.0)
|
|
452
|
+
|
|
453
|
+
- [ ] Automatic Termux-API detection
|
|
454
|
+
- [ ] Termux-aware pre-configuration
|
|
455
|
+
- [ ] Graceful fallback messages
|
|
456
|
+
|
|
457
|
+
---
|
|
458
|
+
|
|
459
|
+
## Files to Modify
|
|
460
|
+
|
|
461
|
+
| File | Modification |
|
|
462
|
+
| --------------------------------------------- | ------------------------- |
|
|
463
|
+
| `package.json` | Add postinstall script |
|
|
464
|
+
| `scripts/postinstall.js` | New file |
|
|
465
|
+
| `scripts/termux-setup.sh` | New file |
|
|
466
|
+
| `Makefile` | Target termux-install |
|
|
467
|
+
| `esbuild.config.js` | Punycode warning suppress |
|
|
468
|
+
| `packages/core/src/utils/termux-detect.ts` | New file |
|
|
469
|
+
| `packages/core/src/config/termux-defaults.ts` | New file |
|
|
470
|
+
|
|
471
|
+
---
|
|
472
|
+
|
|
473
|
+
## Upstream Compatibility
|
|
474
|
+
|
|
475
|
+
The proposed patches are designed to:
|
|
476
|
+
|
|
477
|
+
1. **Not interfere** with desktop functionality
|
|
478
|
+
2. **Be conditional** (active only on Termux)
|
|
479
|
+
3. **Be easily removable** if upstream adds native support
|
|
480
|
+
|
|
481
|
+
---
|
|
482
|
+
|
|
483
|
+
_Author: DioNanos_
|