@mmmbuto/gemini-cli-termux 0.22.7-termux → 0.24.1-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.
Files changed (103) hide show
  1. package/README.md +18 -78
  2. package/bundle/docs/TERMUX.md +97 -0
  3. package/bundle/docs/architecture.md +80 -0
  4. package/bundle/docs/assets/connected_devtools.png +0 -0
  5. package/bundle/docs/assets/gemini-screenshot.png +0 -0
  6. package/bundle/docs/assets/release_patch.png +0 -0
  7. package/bundle/docs/assets/theme-ansi-light.png +0 -0
  8. package/bundle/docs/assets/theme-ansi.png +0 -0
  9. package/bundle/docs/assets/theme-atom-one.png +0 -0
  10. package/bundle/docs/assets/theme-ayu-light.png +0 -0
  11. package/bundle/docs/assets/theme-ayu.png +0 -0
  12. package/bundle/docs/assets/theme-custom.png +0 -0
  13. package/bundle/docs/assets/theme-default-light.png +0 -0
  14. package/bundle/docs/assets/theme-default.png +0 -0
  15. package/bundle/docs/assets/theme-dracula.png +0 -0
  16. package/bundle/docs/assets/theme-github-light.png +0 -0
  17. package/bundle/docs/assets/theme-github.png +0 -0
  18. package/bundle/docs/assets/theme-google-light.png +0 -0
  19. package/bundle/docs/assets/theme-xcode-light.png +0 -0
  20. package/bundle/docs/changelogs/index.md +592 -0
  21. package/bundle/docs/changelogs/latest.md +225 -0
  22. package/bundle/docs/changelogs/preview.md +129 -0
  23. package/bundle/docs/changelogs/releases.md +896 -0
  24. package/bundle/docs/cli/authentication.md +3 -0
  25. package/bundle/docs/cli/checkpointing.md +94 -0
  26. package/bundle/docs/cli/commands.md +354 -0
  27. package/bundle/docs/cli/configuration.md +792 -0
  28. package/bundle/docs/cli/context-memory.md +69 -0
  29. package/bundle/docs/cli/custom-commands.md +315 -0
  30. package/bundle/docs/cli/enterprise.md +565 -0
  31. package/bundle/docs/cli/gemini-ignore.md +71 -0
  32. package/bundle/docs/cli/gemini-md.md +108 -0
  33. package/bundle/docs/cli/generation-settings.md +210 -0
  34. package/bundle/docs/cli/headless.md +388 -0
  35. package/bundle/docs/cli/index.md +63 -0
  36. package/bundle/docs/cli/keyboard-shortcuts.md +143 -0
  37. package/bundle/docs/cli/model-routing.md +37 -0
  38. package/bundle/docs/cli/model.md +62 -0
  39. package/bundle/docs/cli/sandbox.md +171 -0
  40. package/bundle/docs/cli/session-management.md +158 -0
  41. package/bundle/docs/cli/settings.md +114 -0
  42. package/bundle/docs/cli/system-prompt.md +93 -0
  43. package/bundle/docs/cli/telemetry.md +791 -0
  44. package/bundle/docs/cli/themes.md +237 -0
  45. package/bundle/docs/cli/token-caching.md +20 -0
  46. package/bundle/docs/cli/trusted-folders.md +95 -0
  47. package/bundle/docs/cli/tutorials.md +83 -0
  48. package/bundle/docs/cli/uninstall.md +47 -0
  49. package/bundle/docs/core/index.md +101 -0
  50. package/bundle/docs/core/memport.md +244 -0
  51. package/bundle/docs/core/policy-engine.md +267 -0
  52. package/bundle/docs/core/tools-api.md +131 -0
  53. package/bundle/docs/examples/proxy-script.md +83 -0
  54. package/bundle/docs/extensions/extension-releasing.md +183 -0
  55. package/bundle/docs/extensions/getting-started-extensions.md +245 -0
  56. package/bundle/docs/extensions/index.md +293 -0
  57. package/bundle/docs/faq.md +154 -0
  58. package/bundle/docs/get-started/authentication.md +321 -0
  59. package/bundle/docs/get-started/configuration-v1.md +888 -0
  60. package/bundle/docs/get-started/configuration.md +1511 -0
  61. package/bundle/docs/get-started/deployment.md +143 -0
  62. package/bundle/docs/get-started/examples.md +219 -0
  63. package/bundle/docs/get-started/gemini-3.md +116 -0
  64. package/bundle/docs/get-started/index.md +71 -0
  65. package/bundle/docs/get-started/installation.md +141 -0
  66. package/bundle/docs/hooks/best-practices.md +806 -0
  67. package/bundle/docs/hooks/index.md +665 -0
  68. package/bundle/docs/hooks/reference.md +168 -0
  69. package/bundle/docs/hooks/writing-hooks.md +1026 -0
  70. package/bundle/docs/ide-integration/ide-companion-spec.md +267 -0
  71. package/bundle/docs/ide-integration/index.md +202 -0
  72. package/bundle/docs/index.md +147 -0
  73. package/bundle/docs/integration-tests.md +211 -0
  74. package/bundle/docs/issue-and-pr-automation.md +134 -0
  75. package/bundle/docs/local-development.md +128 -0
  76. package/bundle/docs/mermaid/context.mmd +103 -0
  77. package/bundle/docs/mermaid/render-path.mmd +64 -0
  78. package/bundle/docs/npm.md +62 -0
  79. package/bundle/docs/patches/CONTEXT_MEMORY_COMPARISON.md +306 -0
  80. package/bundle/docs/patches/MERGE_TO_0.24_ANALYSIS.md +321 -0
  81. package/bundle/docs/patches/README.md +62 -0
  82. package/bundle/docs/quota-and-pricing.md +158 -0
  83. package/bundle/docs/release-confidence.md +164 -0
  84. package/bundle/docs/releases.md +540 -0
  85. package/bundle/docs/sidebar.json +297 -0
  86. package/bundle/docs/termux-api/COMMANDS.md +592 -0
  87. package/bundle/docs/termux-api/DISCOVERY_SETUP.md +670 -0
  88. package/bundle/docs/termux-api/EXECUTION_PLAN.md +532 -0
  89. package/bundle/docs/termux-api/MERGE_STRATEGY.md +325 -0
  90. package/bundle/docs/termux-api/PATCHES.md +483 -0
  91. package/bundle/docs/termux-api/README.md +416 -0
  92. package/bundle/docs/tools/file-system.md +217 -0
  93. package/bundle/docs/tools/index.md +95 -0
  94. package/bundle/docs/tools/mcp-server.md +1044 -0
  95. package/bundle/docs/tools/memory.md +54 -0
  96. package/bundle/docs/tools/shell.md +260 -0
  97. package/bundle/docs/tools/todos.md +57 -0
  98. package/bundle/docs/tools/web-fetch.md +59 -0
  99. package/bundle/docs/tools/web-search.md +42 -0
  100. package/bundle/docs/tos-privacy.md +96 -0
  101. package/bundle/docs/troubleshooting.md +158 -0
  102. package/bundle/gemini.js +8901 -6534
  103. package/package.json +10 -8
@@ -0,0 +1,306 @@
1
+ # Confronto: contextMemory.ts vs JIT Context Memory
2
+
3
+ ## Tabella Comparativa
4
+
5
+ | Caratteristica | contextMemory.ts (Termux) | JIT Context Memory (Upstream) |
6
+ | ----------------------- | ----------------------------- | ----------------------------- |
7
+ | **Architettura** | Dual JSON + Journal | Lazy loader + Event system |
8
+ | **Persistenza** | 3 file (base/user/journal) | File .gemini.md esistenti |
9
+ | **Formato** | JSON strutturato | Markdown nativo |
10
+ | **Validazione** | Ajv schema (UUID, date, enum) | Nessuna |
11
+ | **Scoping** | global/host/project | None |
12
+ | **Sensitivity filter** | Sì (low/medium/high) | No |
13
+ | **Expiration** | Sì (expiresAt) | No |
14
+ | **Journal append-only** | Sì (JSONL) | No |
15
+ | **Compaction** | Sì (automatica) | No |
16
+ | **MCP import** | Sì (integrato) | No |
17
+ | **UI sync events** | No | Sì (CoreEvent.MemoryChanged) |
18
+ | **Performance** | Batch load + merge | Lazy load |
19
+ | **Complessità** | Alta (~650 righe) | Media (~150 righe) |
20
+ | **Configurabilità** | Molto alta | Bassa (on/off) |
21
+ | **Portable** | Sì (JSON) | No (dipende da file system) |
22
+
23
+ ---
24
+
25
+ ## Analisi Dettagliata
26
+
27
+ ### 1. Architettura
28
+
29
+ #### contextMemory.ts (Termux)
30
+
31
+ ```
32
+ base.json (read-only, di default)
33
+
34
+ user.json (read-write)
35
+
36
+ user.journal.jsonl (append-only)
37
+
38
+ merge + compaction → snapshot in user.json
39
+ ```
40
+
41
+ **Vantaggi:**
42
+
43
+ - Separazione netta tra base (amministratore) e user (utente)
44
+ - Journal append-only per tracciabilità
45
+ - Compaction automatica quando journal > 2MB
46
+ - Merge-safe (più processi possono scrivere nel journal)
47
+
48
+ #### JIT Context Memory (Upstream)
49
+
50
+ ```
51
+ ContextManager.refresh()
52
+
53
+ loadGlobalMemory() → .gemini/Instruction.md
54
+
55
+ loadEnvironmentMemory() → *.gemini.md nel workspace
56
+
57
+ getUserMemory() → getGlobalMemory() + getEnvironmentMemory()
58
+ ```
59
+
60
+ **Vantaggi:**
61
+
62
+ - Usa file .gemini.md esistenti (niente nuovi formati)
63
+ - Lazy loading (carica solo quando serve)
64
+ - Event system per UI sync
65
+ - Semplice da capire
66
+
67
+ ---
68
+
69
+ ### 2. Formato Dati
70
+
71
+ #### contextMemory.ts
72
+
73
+ ```json
74
+ {
75
+ "version": 1,
76
+ "updatedAt": "2025-12-27T10:00:00Z",
77
+ "compactionMeta": {
78
+ "journalBytesProcessed": 1024,
79
+ "lastCompactedAt": "2025-12-27T09:00:00Z"
80
+ },
81
+ "entries": [
82
+ {
83
+ "id": "550e8400-e29b-41d4-a716-446655440000",
84
+ "text": "Preferisco Vim come editor",
85
+ "key": "editor:preference",
86
+ "scope": "global",
87
+ "tags": ["editor", "vim"],
88
+ "sensitivity": "low",
89
+ "expiresAt": "2026-12-27T10:00:00Z",
90
+ "confidence": 0.9,
91
+ "source": "tool"
92
+ }
93
+ ]
94
+ }
95
+ ```
96
+
97
+ **Pro:**
98
+
99
+ - Schema validato (Ajv)
100
+ - Tipi forte (UUID, date-time, enum)
101
+ - Metadati ricchi (confidence, expiration, sensitivity)
102
+ - Supporto per chiavi personalizzate (key)
103
+
104
+ **Contro:**
105
+
106
+ - Verboso
107
+ - Non editabile a mano facilmente
108
+ - Dipende da JSON parser
109
+
110
+ #### JIT Context Memory
111
+
112
+ ```markdown
113
+ # Instruction.md
114
+
115
+ Preferisco Vim come editor.
116
+
117
+ Uso Termux su Android.
118
+
119
+ ---
120
+ ```
121
+
122
+ **Pro:**
123
+
124
+ - Semplice
125
+ - Editabile a mano
126
+ - Nativo Gemini
127
+
128
+ **Contro:**
129
+
130
+ - Non strutturato
131
+ - Nessuna validazione
132
+ - Nessun metadato
133
+
134
+ ---
135
+
136
+ ### 3. Feature Uniche
137
+
138
+ #### contextMemory.ts (Solo Termux)
139
+
140
+ 1. **Sensitivity Filter**
141
+
142
+ ```typescript
143
+ function filterHighSensitivity(entries) {
144
+ return entries.filter((e) => e.sensitivity !== 'high');
145
+ }
146
+ ```
147
+
148
+ Evita di leakare informazioni sensibili all'LLM.
149
+
150
+ 2. **Expiration**
151
+
152
+ ```typescript
153
+ if (e.expiresAt && Date.parse(e.expiresAt) < now) continue;
154
+ ```
155
+
156
+ Le entry scadute vengono automaticamente ignorate.
157
+
158
+ 3. **Journal Append-Only**
159
+
160
+ ```typescript
161
+ await fsp.appendFile(options.paths.journal, `${line}\n`, { mode: 0o600 });
162
+ ```
163
+
164
+ Tracciabilità completa delle modifiche.
165
+
166
+ 4. **MCP Import**
167
+
168
+ ```typescript
169
+ mcpImport: {
170
+ enabled: false,
171
+ categories: ['identity', 'infrastructure', 'projects', 'workflow', 'base'],
172
+ scope: 'global'
173
+ }
174
+ ```
175
+
176
+ Importa memoria da MCP server remoto.
177
+
178
+ 5. **Runtime Options**
179
+
180
+ ```typescript
181
+ setRuntimeContextMemoryOptions(options);
182
+ ```
183
+
184
+ Permette di cambiare configurazione a runtime.
185
+
186
+ #### JIT Context Memory (Solo Upstream)
187
+
188
+ 1. **UI Sync Events**
189
+
190
+ ```typescript
191
+ coreEvents.emit(CoreEvent.MemoryChanged, {
192
+ fileCount: this.loadedPaths.size,
193
+ });
194
+ ```
195
+
196
+ La UI si aggiorna quando la memoria cambia.
197
+
198
+ 2. **Lazy Loading** Carica solo quando serve, non all'avvio.
199
+
200
+ 3. **Workspace Integration** Integrato con `workspaceContext.getDirectories()`.
201
+
202
+ ---
203
+
204
+ ### 4. Performance
205
+
206
+ #### contextMemory.ts
207
+
208
+ - **Avvio**: Legge 3 file JSON (piccoli)
209
+ - **Update**: Append al journal (O(1))
210
+ - **Compaction**: Periodica (ogni 2MB journal)
211
+ - **Memoria**: 50 entry max, 20KB max
212
+
213
+ #### JIT Context Memory
214
+
215
+ - **Avvio**: Scansione file system (\*.gemini.md)
216
+ - **Update**: Riscrittura file .md
217
+ - **Refresh**: Manuale (`/memory` o evento)
218
+ - **Memoria**: Dipende da dimensione file .md
219
+
220
+ **Vincitore**: contextMemory.ts per startup time, JIT per memoria usage.
221
+
222
+ ---
223
+
224
+ ### 5. Sicurezza
225
+
226
+ #### contextMemory.ts
227
+
228
+ ```typescript
229
+ fs.writeFileSync(filePath, payload, { mode: 0o600 }); // rw-------
230
+ ```
231
+
232
+ - File con permessi 0600
233
+ - Sensitivity filter
234
+ - Validazione UUID
235
+ - Sanitizzazione input
236
+
237
+ #### JIT Context Memory
238
+
239
+ - Nessuna misura specifica
240
+ - Dipende da permessi file system
241
+
242
+ **Vincitore**: contextMemory.ts
243
+
244
+ ---
245
+
246
+ ## Quale è Migliore?
247
+
248
+ ### Per Termux/Android: **contextMemory.ts** ⭐
249
+
250
+ **Motivi:**
251
+
252
+ 1. Filesystem mobile è lento → JSON piccolo meglio di scansione .md
253
+ 2. Startup time critico su mobile → batch load più veloce
254
+ 3. Sensitivity filter → privacy su dispositivo personale
255
+ 4. MCP import → utile per integrazione con server MCP
256
+ 5. Compaction automatica → evita file grandi che occupano spazio
257
+
258
+ ### Per Desktop/Workstation: **JIT Context Memory** ⭐
259
+
260
+ **Motivi:**
261
+
262
+ 1. Filesystem veloce → scansione .md non è problema
263
+ 2. Semplicità → utenti possono editare .gemini.md a mano
264
+ 3. UI sync → esperienza desktop più ricca
265
+ 4. Workspace integration → meglio per progetti multipli
266
+
267
+ ---
268
+
269
+ ## Conclusione
270
+
271
+ | Scenario | Raccomandazione |
272
+ | ------------------------- | ---------------------------------------------- |
273
+ | **Termux/Android** | contextMemory.ts |
274
+ | **Desktop single-user** | JIT Context Memory |
275
+ | **Desktop multi-user** | contextMemory.ts (per sensitivity filter) |
276
+ | **Sviluppo attivo** | JIT Context Memory (più semplice da mantenere) |
277
+ | **Produzione/Enterprise** | contextMemory.ts (più robusto) |
278
+
279
+ ### Per il Merge
280
+
281
+ **Mantenere contextMemory.ts come feature Termux-exclusive.**
282
+
283
+ Il sistema JIT è buono per desktop, ma contextMemory.ts è superiore per:
284
+
285
+ - Dispositivi mobili (filesystem lento)
286
+ - Privacy (sensitivity filter)
287
+ - Integrazione MCP
288
+ - Robustezza (validazione, compaction)
289
+
290
+ JIT può essere usato come fallback opzionale per utenti che preferiscono il
291
+ sistema upstream.
292
+
293
+ ```typescript
294
+ if (!experimentalJitContext) {
295
+ // Termux-optimized: contextMemory.ts
296
+ const result = await loadContextMemory(contextMemoryOptions);
297
+ } else {
298
+ // Upstream: JIT context
299
+ await contextManager.refresh();
300
+ }
301
+ ```
302
+
303
+ ---
304
+
305
+ **Autore**: DioNanos **Data**: 2025-12-27 **Verdetto**: contextMemory.ts è
306
+ migliore per Termux, JIT è meglio per desktop
@@ -0,0 +1,321 @@
1
+ # Merge Analysis: 0.22.7-termux → 0.24.0-nightly
2
+
3
+ **Date**: 2025-12-27 **Current**: v0.22.7-termux **Target**:
4
+ v0.24.0-nightly.20251227.37be16243 **Delta**: ~55 commits upstream
5
+
6
+ ---
7
+
8
+ ## Executive Summary
9
+
10
+ Passare alla 0.24.0-nightly è **fattibile** ma richiede la risoluzione di
11
+ conflitti in 5 file. Le patch Termux essenziali sono isolate e possono essere
12
+ preservate.
13
+
14
+ ### Raccomandazione
15
+
16
+ **Procedere con il merge alla 0.24.0-nightly** per le seguenti ragioni:
17
+
18
+ 1. **Feature upstream importanti**: JIT context, A2A client, extension
19
+ management, security fixes
20
+ 2. **Patch Termux preservabili**: Tutte le nostre patch sono in file separati o
21
+ isolati
22
+ 3. **Conflitti gestibili**: Solo 5 file con conflitti, tutti risolvibili
23
+
24
+ ---
25
+
26
+ ## Patch Termux da Preservare (Essential)
27
+
28
+ | File/Feature | Status | Action Required |
29
+ | --------------------------------------------------- | ----------- | -------------------------------- |
30
+ | `packages/core/src/utils/termux-detect.ts` | ✅ OK | Nessuna azione (file nuovo) |
31
+ | `scripts/postinstall.cjs` | ✅ OK | Ri-aggiungere in package.json |
32
+ | `scripts/termux-setup.sh` | ✅ OK | Nessuna azione (file nuovo) |
33
+ | `scripts/termux-tools/` | ✅ OK | Nessuna azione (directory nuova) |
34
+ | `package.json` - `postinstall` script | ⚠️ CONFLICT | Manuale: keep ours |
35
+ | `package.json` - `@esbuild/android-arm64` | ⚠️ CONFLICT | Manuale: re-add |
36
+ | `packages/cli/src/config/config.ts` - `isTermux()` | ⚠️ CONFLICT | Manuale: merge both |
37
+ | `packages/core/src/index.ts` - termux-detect export | ✅ OK | Verifica solo |
38
+
39
+ ---
40
+
41
+ ## File con Conflitti (5)
42
+
43
+ ### 1. package-lock.json
44
+
45
+ **Risoluzione**: `git checkout --ours package-lock.json` e poi `npm install`
46
+
47
+ ### 2. package.json
48
+
49
+ **Conflitto**:
50
+
51
+ - Nome versione: `@google/gemini-cli` vs `@mmmbuto/gemini-cli-termux`
52
+ - Version: `0.24.0-nightly` vs `0.24.0-termux`
53
+ - Scripts: `postinstall` mancante upstream
54
+ - Dependencies: `@esbuild/android-arm64` mancante upstream
55
+
56
+ **Risoluzione**:
57
+
58
+ ```json
59
+ {
60
+ "name": "@mmmbuto/gemini-cli-termux",
61
+ "version": "0.24.0-termux",
62
+ "repository": {
63
+ "url": "https://github.com/DioNanos/gemini-cli-termux.git"
64
+ },
65
+ "scripts": {
66
+ // ... upstream scripts ...
67
+ "postinstall": "node scripts/postinstall.cjs || true"
68
+ },
69
+ "files": ["bundle/", "scripts/postinstall.cjs", "README.md", "LICENSE"],
70
+ "dependencies": {
71
+ // ... upstream deps ...
72
+ "@esbuild/android-arm64": "^0.27.1"
73
+ }
74
+ }
75
+ ```
76
+
77
+ ### 3. packages/cli/src/config/config.ts
78
+
79
+ **Conflitto**: Context memory (nostra implementazione) vs JIT context (upstream)
80
+
81
+ Upstream ha aggiunto `experimentalJitContext` in
82
+ `settings.experimental?.jitContext`. La nostra implementazione context memory è
83
+ più complessa (base/user/journal split).
84
+
85
+ **Risoluzione**:
86
+
87
+ ```typescript
88
+ // Mantenere entrambe le logiche con fallback
89
+ const contextMemoryOptions = buildContextMemoryOptions(settings);
90
+ const experimentalJitContext = settings.experimental?.jitContext ?? false;
91
+
92
+ let memoryContent = '';
93
+ let fileCount = 0;
94
+ let filePaths: string[] = [];
95
+
96
+ if (!experimentalJitContext) {
97
+ // Nostro context memory system
98
+ const result = await loadServerHierarchicalMemory(
99
+ cwd,
100
+ [],
101
+ debugMode,
102
+ quietMode,
103
+ memoryImportFormat,
104
+ memoryFileFiltering,
105
+ settings.context?.discoveryMaxDirs,
106
+ contextMemoryOptions,
107
+ );
108
+ memoryContent = result.memoryContent;
109
+ fileCount = result.fileCount;
110
+ filePaths = result.filePaths;
111
+ } else {
112
+ // Upstream JIT context (minimal)
113
+ const result = await loadServerHierarchicalMemory(
114
+ cwd,
115
+ [],
116
+ debugMode,
117
+ quietMode,
118
+ memoryImportFormat,
119
+ memoryFileFiltering,
120
+ settings.context?.discoveryMaxDirs,
121
+ );
122
+ memoryContent = result.memoryContent;
123
+ fileCount = result.fileCount;
124
+ filePaths = result.filePaths;
125
+ }
126
+ ```
127
+
128
+ **Import da preservare**:
129
+
130
+ ```typescript
131
+ import {
132
+ isTermux,
133
+ setRuntimeContextMemoryOptions,
134
+ } from '@google/gemini-cli-core';
135
+ ```
136
+
137
+ **Logica isTermux da preservare**:
138
+
139
+ ```typescript
140
+ const allowedTools = argv.allowedTools || settings.tools?.allowed || [];
141
+ if (isTermux() && !allowedTools.includes(SHELL_TOOL_NAME)) {
142
+ allowedTools.push(SHELL_TOOL_NAME);
143
+ }
144
+ ```
145
+
146
+ ### 4. packages/core/src/config/config.ts
147
+
148
+ **Conflitto**: Import type differences
149
+
150
+ **Risoluzione**: Keep ours (include context memory types)
151
+
152
+ ### 5. packages/core/src/utils/shell-utils.ts
153
+
154
+ **Conflitto**: web-tree-sitter import position
155
+
156
+ Upstream ha spostato l'import dentro la funzione. Noi lo abbiamo in alto.
157
+
158
+ **Risoluzione**: Keep upstream (la loro ottimizzazione è migliore)
159
+
160
+ ---
161
+
162
+ ## Feature Upstream Notevoli (0.22.7 → 0.24.0)
163
+
164
+ | Commit | Feature | Relevance to Termux |
165
+ | ----------- | ------------------------------------ | ------------------- |
166
+ | `37be16243` | Shell command allowlisting in policy | 🔒 Security |
167
+ | `563d81e08` | In-CLI extension install/uninstall | 🆕 Feature |
168
+ | `02a36afc3` | A2A Client Manager | 🆕 Feature |
169
+ | `6be034392` | Automatic `/model` persistence | 📱 UX |
170
+ | `3b1dbcd42` | Secrets sanitization | 🔒 Security |
171
+ | `e9a601c1f` | MCPServerConfig fix | 🔧 Bugfix |
172
+ | `e6344a8c2` | Project-level hook warnings | 🔒 Security |
173
+ | `0a216b28f` | Fix EIO crash in readStdin | 🐛 Bugfix |
174
+ | `8feeffb29` | Fix infinite relaunch loop | 🐛 Bugfix |
175
+ | `2e229d3bb` | JIT context memory | 🚀 Performance |
176
+
177
+ ---
178
+
179
+ ## Procedure di Merge
180
+
181
+ ### Step 1: Preparazione
182
+
183
+ ```bash
184
+ cd ~/Dev/gemini-cli-termux
185
+ git fetch upstream --tags
186
+ git checkout -b merge-0.24.0-termux
187
+ ```
188
+
189
+ ### Step 2: Merge
190
+
191
+ ```bash
192
+ git merge v0.24.0-nightly.20251227.37be16243 --no-edit
193
+ ```
194
+
195
+ ### Step 3: Risoluzione Conflitti
196
+
197
+ ```bash
198
+ # 1. package-lock.json - keep ours
199
+ git checkout --ours package-lock.json
200
+
201
+ # 2. package.json - edit manuale
202
+ # (vedere sezione sopra)
203
+
204
+ # 3. packages/cli/src/config/config.ts - merge manuale
205
+ # (vedere sezione sopra)
206
+
207
+ # 4. packages/core/src/config/config.ts - keep ours
208
+ git checkout --ours packages/core/src/config/config.ts
209
+
210
+ # 5. packages/core/src/utils/shell-utils.ts - keep upstream
211
+ git checkout --theirs packages/core/src/utils/shell-utils.ts
212
+ ```
213
+
214
+ ### Step 4: Verifica
215
+
216
+ ```bash
217
+ # Verifica patch Termux
218
+ bash scripts/check-termux-patches.sh
219
+
220
+ # Verifica imports
221
+ grep -r "isTermux" packages/cli/src/config/config.ts
222
+ grep "termux-detect" packages/core/src/index.ts
223
+
224
+ # Build test
225
+ npm install --ignore-optional --ignore-scripts
226
+ npm run build
227
+ npm run bundle
228
+ node bundle/gemini.js --version # deve essere 0.24.0-termux
229
+ ```
230
+
231
+ ### Step 5: Commit
232
+
233
+ ```bash
234
+ git add .
235
+ git commit -m "merge: upstream v0.24.0-nightly + Termux patches preserved
236
+
237
+ - Merged v0.24.0-nightly.20251227.37be16243 (55 commits)
238
+ - Preserved Termux patches:
239
+ - termux-detect.ts utility
240
+ - postinstall.cjs message
241
+ - termux-setup.sh helper
242
+ - termux-tools/ integration
243
+ - isTermux() in config.ts
244
+ - Context memory system (base/user/journal)
245
+ - Resolved conflicts in 5 files
246
+ - Version bump to 0.24.0-termux
247
+ "
248
+ ```
249
+
250
+ ### Step 6: Tag e Test
251
+
252
+ ```bash
253
+ git tag v0.24.0-termux
254
+ npm run bundle
255
+ # Test su Termux
256
+ ```
257
+
258
+ ---
259
+
260
+ ## Aggiornamenti da Fare Post-Merge
261
+
262
+ ### docs/patches/README.md
263
+
264
+ Aggiornare versione a 0.24.0-termux e aggiungere nuove feature upstream.
265
+
266
+ ### README.md
267
+
268
+ Aggiornare versione expected da:
269
+
270
+ ```markdown
271
+ gemini --version # expected: 0.22.2-termux (npm latest)
272
+ ```
273
+
274
+ a:
275
+
276
+ ```markdown
277
+ gemini --version # expected: 0.24.0-termux (npm latest)
278
+ ```
279
+
280
+ ### package.json (packages/cli)
281
+
282
+ Aggiornare versione e sandboxImageUri.
283
+
284
+ ---
285
+
286
+ ## Rischio e Mitigazione
287
+
288
+ | Rischio | Probabilità | Mitigazione |
289
+ | ------------------------- | ----------- | -------------------------------------- |
290
+ | Context memory regression | Bassa | Test completo memory system |
291
+ | Shell tool breakage | Bassa | Verificare isTermux() logic |
292
+ | Build failure | Molto bassa | --ignore-optional --ignore-scripts |
293
+ | npm publish issues | Bassa | Verificare files array in package.json |
294
+
295
+ ---
296
+
297
+ ## Checklist Pre-Merge
298
+
299
+ - [ ] Backup del branch corrente (`git branch backup-pre-0.24`)
300
+ - [ ] Fetch upstream tags
301
+ - [ ] Verificare che `termux-detect.ts` è esportato in core/index.ts
302
+ - [ ] Verificare che `postinstall.cjs` esiste
303
+ - [ ] Verificare che `scripts/termux-tools/` è completo
304
+
305
+ ---
306
+
307
+ ## Checklist Post-Merge
308
+
309
+ - [ ] Tutti i 5 conflitti risolti
310
+ - [ ] `bash scripts/check-termux-patches.sh` passa
311
+ - [ ] `npm run build` completa senza errori
312
+ - [ ] `npm run bundle` crea `bundle/gemini.js`
313
+ - [ ] `node bundle/gemini.js --version` mostra 0.24.0-termux
314
+ - [ ] Test funzionali su Termux (shell, clipboard, etc.)
315
+ - [ ] Aggiornato README.md
316
+ - [ ] Aggiornato docs/patches/README.md
317
+ - [ ] Creato tag v0.24.0-termux
318
+
319
+ ---
320
+
321
+ **Autore**: DioNanos **Data**: 2025-12-27 **Stato**: Pronto per merge
@@ -0,0 +1,62 @@
1
+ # Termux Patches (0.22.7-termux testing)
2
+
3
+ Minimal changes to run `gemini-cli` on Android/Termux ARM64 without native deps.
4
+
5
+ ## Patch List
6
+
7
+ 1. **Clipboard (TERMUX\_\_PREFIX)** – On Termux set `TERMUX__PREFIX` from
8
+ `$PREFIX` so clipboardy detects Termux correctly.
9
+ 2. **Optional native modules** – Leave `node-pty`, `keytar`, `tree-sitter-bash`
10
+ in `optionalDependencies`; build failures are tolerated.
11
+ 3. **Core exports** – `packages/core/src/index.ts` re-exports stdio utilities,
12
+ hook/telemetry APIs, Termux detectors, and context-memory helpers so CLI
13
+ bundling succeeds on Termux.
14
+ 4. **Bundle** – Prebuilt `bundle/gemini.js` shipped in npm package
15
+ (ARM64/Android) with policy files under `bundle/policies/`.
16
+ 5. **is-in-ci override** – Prevents ink from detecting Termux as CI.
17
+ 6. **Punycode warning** – Suppresses deprecation warning on Android.
18
+ 7. **Termux detection** – `packages/core/src/utils/termux-detect.ts` utility.
19
+ 8. **Postinstall message** – Clear success message on Termux install.
20
+ 9. **Context memory revamp** – Dual JSON (base RO + user RW) plus journal
21
+ (`user.journal.jsonl`), auto-load toggles, primary selector, and MCP import
22
+ tool (disabled by default; base writes still gated).
23
+ 10. **Mobile-first settings** – Compact `/settings` rendering by default on
24
+ Termux; TTS toggle exposed (opt-in).
25
+ 11. **Shell parser fix** – Tree-sitter for bash loaded lazily after Base64
26
+ polyfill; resolves `Uint8Array.fromBase64` crash on Termux Node 22/24.
27
+
28
+ ## New in 0.22.7 (testing)
29
+
30
+ - **Gemini 3 Flash preview** exposed in model list/help.
31
+ - MCP import tool (`mcp_import_memory`) to pull remote MCP data into base/user
32
+ memories when enabled.
33
+ - Context memory split (base/user/journal) with merge-safe compaction and
34
+ high-sensitivity auto-load filtering.
35
+ - Mobile settings view default-on; TTS enable/disable switch.
36
+ - Bash parser initialization hardened for Termux runtime (fixes
37
+ `run_shell_command` crashes).
38
+
39
+ ## New in 0.22.2
40
+
41
+ - Termux-API tool discovery support (`scripts/termux-tools/`)
42
+ - Improved installation experience (`scripts/postinstall.js`)
43
+ - Helper scripts for build from source (`scripts/termux-setup.sh`)
44
+ - Makefile targets: `termux-install`, `termux-clean`
45
+ - Merge verification script (`scripts/check-termux-patches.sh`)
46
+
47
+ ## Expected Warnings
48
+
49
+ - Missing native modules may log warnings on Termux; functionality remains
50
+ (non-PTY shell, plain token storage).
51
+
52
+ ## Scope
53
+
54
+ No functional changes to upstream features; only compatibility/export fixes.
55
+
56
+ ## Merge Strategy
57
+
58
+ All patches are designed to be merge-safe. See
59
+ [docs/termux-api/MERGE_STRATEGY.md](../termux-api/MERGE_STRATEGY.md) for details
60
+ on maintaining patches after upstream sync.
61
+
62
+ **Version**: 0.22.7-termux (testing) / latest dist-tag: 0.22.2-termux