@mmmbuto/gemini-cli-termux 0.22.6-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.
Files changed (104) hide show
  1. package/README.md +24 -21
  2. package/bundle/README.md +239 -0
  3. package/bundle/docs/TERMUX.md +97 -0
  4. package/bundle/docs/architecture.md +80 -0
  5. package/bundle/docs/assets/connected_devtools.png +0 -0
  6. package/bundle/docs/assets/gemini-screenshot.png +0 -0
  7. package/bundle/docs/assets/release_patch.png +0 -0
  8. package/bundle/docs/assets/theme-ansi-light.png +0 -0
  9. package/bundle/docs/assets/theme-ansi.png +0 -0
  10. package/bundle/docs/assets/theme-atom-one.png +0 -0
  11. package/bundle/docs/assets/theme-ayu-light.png +0 -0
  12. package/bundle/docs/assets/theme-ayu.png +0 -0
  13. package/bundle/docs/assets/theme-custom.png +0 -0
  14. package/bundle/docs/assets/theme-default-light.png +0 -0
  15. package/bundle/docs/assets/theme-default.png +0 -0
  16. package/bundle/docs/assets/theme-dracula.png +0 -0
  17. package/bundle/docs/assets/theme-github-light.png +0 -0
  18. package/bundle/docs/assets/theme-github.png +0 -0
  19. package/bundle/docs/assets/theme-google-light.png +0 -0
  20. package/bundle/docs/assets/theme-xcode-light.png +0 -0
  21. package/bundle/docs/changelogs/index.md +592 -0
  22. package/bundle/docs/changelogs/latest.md +225 -0
  23. package/bundle/docs/changelogs/preview.md +129 -0
  24. package/bundle/docs/changelogs/releases.md +896 -0
  25. package/bundle/docs/cli/authentication.md +3 -0
  26. package/bundle/docs/cli/checkpointing.md +94 -0
  27. package/bundle/docs/cli/commands.md +354 -0
  28. package/bundle/docs/cli/configuration.md +792 -0
  29. package/bundle/docs/cli/context-memory.md +69 -0
  30. package/bundle/docs/cli/custom-commands.md +315 -0
  31. package/bundle/docs/cli/enterprise.md +565 -0
  32. package/bundle/docs/cli/gemini-ignore.md +71 -0
  33. package/bundle/docs/cli/gemini-md.md +108 -0
  34. package/bundle/docs/cli/generation-settings.md +210 -0
  35. package/bundle/docs/cli/headless.md +388 -0
  36. package/bundle/docs/cli/index.md +63 -0
  37. package/bundle/docs/cli/keyboard-shortcuts.md +143 -0
  38. package/bundle/docs/cli/model-routing.md +37 -0
  39. package/bundle/docs/cli/model.md +62 -0
  40. package/bundle/docs/cli/sandbox.md +171 -0
  41. package/bundle/docs/cli/session-management.md +158 -0
  42. package/bundle/docs/cli/settings.md +114 -0
  43. package/bundle/docs/cli/system-prompt.md +93 -0
  44. package/bundle/docs/cli/telemetry.md +791 -0
  45. package/bundle/docs/cli/themes.md +237 -0
  46. package/bundle/docs/cli/token-caching.md +20 -0
  47. package/bundle/docs/cli/trusted-folders.md +95 -0
  48. package/bundle/docs/cli/tutorials.md +83 -0
  49. package/bundle/docs/cli/uninstall.md +47 -0
  50. package/bundle/docs/core/index.md +101 -0
  51. package/bundle/docs/core/memport.md +244 -0
  52. package/bundle/docs/core/policy-engine.md +267 -0
  53. package/bundle/docs/core/tools-api.md +131 -0
  54. package/bundle/docs/examples/proxy-script.md +83 -0
  55. package/bundle/docs/extensions/extension-releasing.md +183 -0
  56. package/bundle/docs/extensions/getting-started-extensions.md +245 -0
  57. package/bundle/docs/extensions/index.md +293 -0
  58. package/bundle/docs/faq.md +154 -0
  59. package/bundle/docs/get-started/authentication.md +321 -0
  60. package/bundle/docs/get-started/configuration-v1.md +888 -0
  61. package/bundle/docs/get-started/configuration.md +1511 -0
  62. package/bundle/docs/get-started/deployment.md +143 -0
  63. package/bundle/docs/get-started/examples.md +219 -0
  64. package/bundle/docs/get-started/gemini-3.md +116 -0
  65. package/bundle/docs/get-started/index.md +71 -0
  66. package/bundle/docs/get-started/installation.md +141 -0
  67. package/bundle/docs/hooks/best-practices.md +806 -0
  68. package/bundle/docs/hooks/index.md +665 -0
  69. package/bundle/docs/hooks/reference.md +168 -0
  70. package/bundle/docs/hooks/writing-hooks.md +1026 -0
  71. package/bundle/docs/ide-integration/ide-companion-spec.md +267 -0
  72. package/bundle/docs/ide-integration/index.md +202 -0
  73. package/bundle/docs/index.md +147 -0
  74. package/bundle/docs/integration-tests.md +211 -0
  75. package/bundle/docs/issue-and-pr-automation.md +134 -0
  76. package/bundle/docs/local-development.md +128 -0
  77. package/bundle/docs/mermaid/context.mmd +103 -0
  78. package/bundle/docs/mermaid/render-path.mmd +64 -0
  79. package/bundle/docs/npm.md +62 -0
  80. package/bundle/docs/patches/CONTEXT_MEMORY_COMPARISON.md +306 -0
  81. package/bundle/docs/patches/MERGE_TO_0.24_ANALYSIS.md +321 -0
  82. package/bundle/docs/patches/README.md +62 -0
  83. package/bundle/docs/quota-and-pricing.md +158 -0
  84. package/bundle/docs/release-confidence.md +164 -0
  85. package/bundle/docs/releases.md +540 -0
  86. package/bundle/docs/sidebar.json +297 -0
  87. package/bundle/docs/termux-api/COMMANDS.md +592 -0
  88. package/bundle/docs/termux-api/DISCOVERY_SETUP.md +670 -0
  89. package/bundle/docs/termux-api/EXECUTION_PLAN.md +532 -0
  90. package/bundle/docs/termux-api/MERGE_STRATEGY.md +325 -0
  91. package/bundle/docs/termux-api/PATCHES.md +483 -0
  92. package/bundle/docs/termux-api/README.md +416 -0
  93. package/bundle/docs/tools/file-system.md +217 -0
  94. package/bundle/docs/tools/index.md +95 -0
  95. package/bundle/docs/tools/mcp-server.md +1044 -0
  96. package/bundle/docs/tools/memory.md +54 -0
  97. package/bundle/docs/tools/shell.md +260 -0
  98. package/bundle/docs/tools/todos.md +57 -0
  99. package/bundle/docs/tools/web-fetch.md +59 -0
  100. package/bundle/docs/tools/web-search.md +42 -0
  101. package/bundle/docs/tos-privacy.md +96 -0
  102. package/bundle/docs/troubleshooting.md +158 -0
  103. package/bundle/gemini.js +35198 -32245
  104. package/package.json +10 -8
@@ -0,0 +1,325 @@
1
+ # Merge Strategy - Upstream Sync
2
+
3
+ **Project**: gemini-cli-termux **Author**: DioNanos **Date**: 2025-12-17
4
+
5
+ ---
6
+
7
+ ## Overview
8
+
9
+ Strategy for maintaining Termux patches easily applicable after each merge with
10
+ the upstream `google-gemini/gemini-cli`.
11
+
12
+ ---
13
+
14
+ ## Design Principles
15
+
16
+ ### 1. Patch Isolation
17
+
18
+ All Termux modifications must be:
19
+
20
+ - **Isolated** in separate files when possible
21
+ - **Conditional** (`if (isTermux())`)
22
+ - **Additive** rather than modifying existing code
23
+ - **Documented** with `// TERMUX PATCH:` comments
24
+
25
+ ### 2. File Strategy
26
+
27
+ | Type | Approach | Merge Conflicts |
28
+ | ---------------- | ---------- | --------------- |
29
+ | **New files** | Preferred | None |
30
+ | **Minimal edit** | Acceptable | Rare |
31
+ | **Refactor** | Avoid | Frequent |
32
+
33
+ ### 3. Patch-Friendly Structure
34
+
35
+ ```
36
+ gemini-cli-termux/
37
+ ├── packages/core/src/
38
+ │ ├── utils/
39
+ │ │ └── termux-detect.ts # NEW - no conflicts
40
+ │ │ └── contextMemory.ts # NEW - Termux context memory logic
41
+ │ └── index.ts # Minimal EDIT - 2 export lines
42
+ ├── scripts/
43
+ │ ├── postinstall.js # NEW - no conflicts
44
+ │ ├── termux-setup.sh # NEW - no conflicts
45
+ │ └── termux-tools/ # NEW - no conflicts
46
+ │ ├── discovery.sh
47
+ │ └── call.sh
48
+ ├── esbuild.config.js # EDIT - banner (isolated)
49
+ ├── package.json # EDIT - scripts.postinstall, dist-tags
50
+ └── Makefile # EDIT - additional targets
51
+ ```
52
+
53
+ ---
54
+
55
+ ## Upstream Merge Procedure
56
+
57
+ ### Step 1: Fetch upstream
58
+
59
+ ```bash
60
+ cd ~/Dev/gemini-cli-termux
61
+ git remote add upstream https://github.com/google-gemini/gemini-cli.git 2>/dev/null || true
62
+ git fetch upstream
63
+ ```
64
+
65
+ ### Step 2: Create merge branch
66
+
67
+ ```bash
68
+ git checkout -b merge-upstream-vX.Y.Z
69
+ git merge upstream/main --no-commit
70
+ ```
71
+
72
+ ### Step 3: Resolve conflicts (if any)
73
+
74
+ Likely conflict files:
75
+
76
+ - `package.json` - Resolve by keeping our scripts
77
+ - `esbuild.config.js` - Resolve by keeping our banner
78
+ - `packages/core/src/index.ts` - Resolve by keeping our exports
79
+
80
+ ### Step 4: Verify patches intact
81
+
82
+ ```bash
83
+ # Check that our files still exist
84
+ ls -la packages/core/src/utils/termux-detect.ts
85
+ ls -la scripts/postinstall.js
86
+ ls -la scripts/termux-setup.sh
87
+ ls -la scripts/termux-tools/
88
+
89
+ # Check that modifications are present
90
+ grep "TERMUX__PREFIX" esbuild.config.js
91
+ grep "postinstall" package.json
92
+ grep "termux-detect" packages/core/src/index.ts
93
+ ```
94
+
95
+ ### Step 5: Build test
96
+
97
+ ```bash
98
+ npm install --ignore-optional --ignore-scripts
99
+ npm run build
100
+ npm run bundle
101
+ node bundle/gemini.js --version
102
+ ```
103
+
104
+ ### Step 6: Commit merge
105
+
106
+ ```bash
107
+ git add .
108
+ git commit -m "merge: upstream vX.Y.Z + Termux patches"
109
+ ```
110
+
111
+ ---
112
+
113
+ ## Common Conflicts and Solutions
114
+
115
+ ### package.json
116
+
117
+ **Typical conflict**: `scripts` section modified upstream
118
+
119
+ **Solution**:
120
+
121
+ ```json
122
+ {
123
+ "scripts": {
124
+ // ... upstream scripts ...
125
+ "postinstall": "node scripts/postinstall.js || true" // TERMUX PATCH
126
+ }
127
+ }
128
+ ```
129
+
130
+ ### esbuild.config.js
131
+
132
+ **Typical conflict**: `banner` modified upstream
133
+
134
+ **Solution**: Keep our banner with comment
135
+
136
+ ```javascript
137
+ banner: {
138
+ js: `/* UPSTREAM BANNER */
139
+ // TERMUX PATCH START
140
+ if (process.platform === 'android' && process.env.PREFIX && !process.env.TERMUX__PREFIX) {
141
+ process.env.TERMUX__PREFIX = process.env.PREFIX;
142
+ }
143
+ // TERMUX PATCH END
144
+ `,
145
+ },
146
+ ```
147
+
148
+ ### packages/core/src/index.ts
149
+
150
+ **Typical conflict**: Exports added/modified upstream
151
+
152
+ **Solution**: Add our export at the end
153
+
154
+ ```typescript
155
+ // ... upstream exports ...
156
+
157
+ // TERMUX PATCH
158
+ export * from './utils/termux-detect.js';
159
+ export * from './utils/contextMemory.js';
160
+
161
+ ### Context memory safety
162
+
163
+ - Keep `contextMemory.ts` additive; if upstream adds similar logic, retain
164
+ Termux fields `allowBaseWrite`, runtime setters, key/TTL guards, sensitivity
165
+ filter, and incremental journal processing.
166
+
167
+ ### Shell / TTS guard
168
+
169
+ - `packages/core/src/tools/shell.ts` contains a guard to block
170
+ `termux-tts-speak` when `notifications.ttsEnabled` is false. Re-apply after
171
+ merges if the shell tool changes.
172
+ ```
173
+
174
+ ---
175
+
176
+ ## Merge Check Automation
177
+
178
+ ### Post-merge verification script
179
+
180
+ **File**: `scripts/check-termux-patches.sh`
181
+
182
+ ```bash
183
+ #!/bin/bash
184
+ # Verify that Termux patches are intact after a merge
185
+
186
+ set -e
187
+
188
+ echo "=== Checking Termux Patches ==="
189
+
190
+ ERRORS=0
191
+
192
+ # Check file existence
193
+ FILES=(
194
+ "packages/core/src/utils/termux-detect.ts"
195
+ "scripts/postinstall.js"
196
+ "scripts/termux-setup.sh"
197
+ "scripts/termux-tools/discovery.sh"
198
+ "scripts/termux-tools/call.sh"
199
+ )
200
+
201
+ for f in "${FILES[@]}"; do
202
+ if [ -f "$f" ]; then
203
+ echo "✓ $f exists"
204
+ else
205
+ echo "✗ $f MISSING"
206
+ ERRORS=$((ERRORS + 1))
207
+ fi
208
+ done
209
+
210
+ # Check key contents
211
+ if grep -q "TERMUX__PREFIX" esbuild.config.js; then
212
+ echo "✓ esbuild.config.js has TERMUX patch"
213
+ else
214
+ echo "✗ esbuild.config.js MISSING TERMUX patch"
215
+ ERRORS=$((ERRORS + 1))
216
+ fi
217
+
218
+ if grep -q "postinstall" package.json; then
219
+ echo "✓ package.json has postinstall"
220
+ else
221
+ echo "✗ package.json MISSING postinstall"
222
+ ERRORS=$((ERRORS + 1))
223
+ fi
224
+
225
+ if grep -q "termux-detect" packages/core/src/index.ts; then
226
+ echo "✓ core/index.ts has termux-detect export"
227
+ else
228
+ echo "✗ core/index.ts MISSING termux-detect export"
229
+ ERRORS=$((ERRORS + 1))
230
+ fi
231
+
232
+ echo ""
233
+ if [ $ERRORS -eq 0 ]; then
234
+ echo "=== All patches intact ==="
235
+ exit 0
236
+ else
237
+ echo "=== $ERRORS patches missing/broken ==="
238
+ exit 1
239
+ fi
240
+ ```
241
+
242
+ ### Git Hook (optional)
243
+
244
+ **File**: `.husky/post-merge`
245
+
246
+ ```bash
247
+ #!/bin/bash
248
+ bash scripts/check-termux-patches.sh || echo "WARNING: Termux patches need attention!"
249
+ ```
250
+
251
+ ---
252
+
253
+ ## Tracking Upstream Changes
254
+
255
+ ### Files to monitor
256
+
257
+ | Upstream File | Impact | Action |
258
+ | ---------------------------- | ------ | -------------- |
259
+ | `package.json` | High | Verify scripts |
260
+ | `esbuild.config.js` | High | Verify banner |
261
+ | `packages/core/src/index.ts` | Medium | Verify exports |
262
+ | `packages/core/src/tools/*` | Low | No action |
263
+ | `packages/cli/*` | Low | No action |
264
+
265
+ ### Changelog Tracking
266
+
267
+ Keep note of integrated upstream versions:
268
+
269
+ ```
270
+ docs/termux-api/UPSTREAM_TRACKING.md
271
+ ```
272
+
273
+ ```markdown
274
+ # Upstream Tracking
275
+
276
+ | Version | Date | Notes |
277
+ | -------------- | ---------- | ------------------ |
278
+ | 0.21.0-nightly | 2025-12-12 | Initial fork base |
279
+ | 0.22.0-nightly | 2025-12-17 | Synced, patches ok |
280
+ ```
281
+
282
+ ---
283
+
284
+ ## Minimizing Future Conflicts
285
+
286
+ ### DO
287
+
288
+ - ✅ Create new files instead of modifying existing ones
289
+ - ✅ Use wrapper functions instead of modifying existing ones
290
+ - ✅ Add to the end of files instead of the middle
291
+ - ✅ Use `// TERMUX PATCH` comments to identify modifications
292
+ - ✅ Keep changes atomic and isolated
293
+
294
+ ### DON'T
295
+
296
+ - ❌ Rename upstream variables/functions
297
+ - ❌ Restructure upstream code
298
+ - ❌ Modify existing core logic
299
+ - ❌ Add dependencies that require native build
300
+ - ❌ Remove upstream code (only add conditionals)
301
+
302
+ ---
303
+
304
+ ## Recovery from Failed Merge
305
+
306
+ If a merge creates too many conflicts:
307
+
308
+ ```bash
309
+ # Abort merge
310
+ git merge --abort
311
+
312
+ # Cherry-pick our commits instead
313
+ git log --oneline | head -20 # Find Termux commits
314
+ git checkout -b manual-merge upstream/main
315
+ git cherry-pick <commit1> <commit2> ...
316
+
317
+ # Or re-apply patch manually
318
+ git diff main~5..main > termux-patches.diff
319
+ git checkout upstream/main
320
+ git apply termux-patches.diff
321
+ ```
322
+
323
+ ---
324
+
325
+ _Author: DioNanos_