@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
package/README.md CHANGED
@@ -29,7 +29,7 @@ pkg update && pkg upgrade -y
29
29
  pkg install nodejs-lts -y
30
30
  npm install -g @mmmbuto/gemini-cli-termux
31
31
 
32
- gemini --version # expected: 0.22.3-termux (latest)
32
+ gemini --version # expected: 0.24.0-termux (npm latest)
33
33
  ```
34
34
 
35
35
  Build from source:
@@ -64,9 +64,12 @@ node bundle/gemini.js --version
64
64
 
65
65
  ### 📚 Complete Documentation
66
66
 
67
- - **[Test Results](./GEMINI_TEST_REPORT_v0.22.1.md)** - Comprehensive test
68
- report with analysis
67
+ - **Test Results**
68
+ - [GEMINI_TEST_REPORT_v0.24.0.md](./GEMINI_TEST_REPORT_v0.24.0.md) — PASS
69
+ (partial execution; interactive steps pending)
69
70
  - **[Test Suite](./GEMINI_TEST_SUITE.md)** - Test methodology and checklist
71
+ - **[Context Memory](./docs/cli/context-memory.md)** - Memory modes, JIT + JSON,
72
+ and setup guide
70
73
  - **[Patches & Fixes](./docs/patches/)** - Known issues and workarounds
71
74
 
72
75
  ### 🔧 Common Issues & Solutions
@@ -102,37 +105,34 @@ See [docs/patches/README.md](./docs/patches/README.md) for complete solutions.
102
105
  npm install -g @mmmbuto/gemini-cli-termux@latest
103
106
  ```
104
107
 
105
- ### Versions
108
+ ### Changelog (0.24.0-termux)
106
109
 
107
- - **latest**: 0.22.3-termux (this build)
108
- - **stable**: 0.22.3-termux
110
+ - **Memory Mode presets** in `/settings → Memory` (default / jit / jit+json).
111
+ - **JIT + JSON** combined memory support (ContextManager now loads JSON memory).
112
+ - **Memory settings reorganized** into a dedicated section; MCP import
113
+ categories hidden from UI.
114
+ - **Docs & tests refreshed** for 0.24.0-termux.
109
115
 
110
116
  ## Tests
111
117
 
112
118
  - Suite: [`GEMINI_TEST_SUITE.md`](./GEMINI_TEST_SUITE.md)
113
119
  - Latest report:
114
- [`GEMINI_TEST_REPORT_v0.22.1.md`](./GEMINI_TEST_REPORT_v0.22.1.md)
115
- - PASS with warnings (node-pty optional missing log; `--version --json`
116
- outputs plain string; config-path flag unsupported; extensions settings
117
- needs subcommand).
118
- - Non-interactive/file tests executed via agent; Termux checks pass;
119
- package/bundle verified.
120
- - Optional native modules (node-pty, keytar, tree-sitter-bash) not built on
121
- Termux → warnings expected; CLI remains functional.
120
+ - [`GEMINI_TEST_REPORT_v0.24.0.md`](./GEMINI_TEST_REPORT_v0.24.0.md) — PASS
121
+ (partial execution; interactive steps pending). Notes include
122
+ non‑interactive tool confirmation limits.
122
123
 
123
- ## Termux-API Integration (NEW!)
124
+ ## Termux-API Integration
124
125
 
125
126
  This fork supports optional integration with Termux-API commands for Android
126
127
  device access. Enable Gemini to interact with your device hardware and Android
127
128
  features.
128
129
 
129
- **Context memory + TTS note:**
130
+ ## Context memory + TTS note:
130
131
 
131
132
  - The Termux fork ships JSON context memory at
132
133
  `~/.gemini/context_memory/{base.json,user.json,user.journal.jsonl}`. In
133
- `/settings → Context Memory` you can toggle autoload, choose the primary
134
- source, and (if needed) enable writes to `base.json` via
135
- `Allow Base Memory Writes`.
134
+ `/settings → Memory` you can select **Memory Mode** (default / jit / jit+json)
135
+ and adjust Context Memory options (autoload, primary ordering, base writes).
136
136
  - TTS notifications are controlled by
137
137
  `/settings → Notifications → Enable TTS Notifications`. When disabled,
138
138
  `termux-tts-speak` is blocked even if an agent asks for it. These behaviors
@@ -169,7 +169,10 @@ See [docs/termux-api/](./docs/termux-api/) for complete documentation.
169
169
 
170
170
  ---
171
171
 
172
- ## v0.22.3-termux Highlights
172
+ ## v0.22.7-termux (testing) Highlights
173
+
174
+ - **Gemini 3 Flash preview** enabled (`gemini-3-flash-preview`) with help/docs
175
+ visibility.
173
176
 
174
177
  - **Context Memory (default ON)**: strict, merge-safe JSON memory at
175
178
  `~/.gemini/context_memory/{base.json,user.json,user.journal.jsonl}` with
@@ -188,7 +191,7 @@ See [docs/termux-api/](./docs/termux-api/) for complete documentation.
188
191
 
189
192
  See `docs/cli/context-memory.md` for the detailed memory layout and settings.
190
193
 
191
- ## v0.22.1-termux Improvements
194
+ ## v0.22.2-termux Improvements
192
195
 
193
196
  This release includes significant improvements to the Termux experience:
194
197
 
@@ -0,0 +1,239 @@
1
+ # 🤖 Gemini CLI – Termux Edition
2
+
3
+ Android/Termux optimized fork of Google Gemini CLI. Installs cleanly on Termux
4
+ by skipping native modules and adding clipboard detection for Termux.
5
+
6
+ [![npm](https://img.shields.io/npm/v/@mmmbuto/gemini-cli-termux?style=flat-square&logo=npm)](https://www.npmjs.com/package/@mmmbuto/gemini-cli-termux)
7
+ [![downloads](https://img.shields.io/npm/dt/@mmmbuto/gemini-cli-termux?style=flat-square)](https://www.npmjs.com/package/@mmmbuto/gemini-cli-termux)
8
+ [![ko-fi](https://img.shields.io/badge/☕_Support-Ko--fi-FF5E5B?style=flat-square&logo=ko-fi)](https://ko-fi.com/dionanos)
9
+
10
+ ---
11
+
12
+ ## What This Is
13
+
14
+ **Optimized Termux edition** of `google-gemini/gemini-cli`.
15
+
16
+ This project focuses on maintaining a first-class experience for Gemini on
17
+ Android/Termux. It provides critical adaptations for the mobile environment
18
+ while tracking upstream development closely.
19
+
20
+ - **Termux-First:** Pre-configured for Android filesystem and clipboard.
21
+ - **Lightweight:** Native dependencies managed for ARM64 without complex
22
+ compilation.
23
+ - **Up-to-Date:** Synchronized with the latest Google Gemini CLI features.
24
+
25
+ ## Installation (Termux)
26
+
27
+ ```bash
28
+ pkg update && pkg upgrade -y
29
+ pkg install nodejs-lts -y
30
+ npm install -g @mmmbuto/gemini-cli-termux
31
+
32
+ gemini --version # expected: 0.22.2-termux (npm latest); 0.22.7-termux available on testing channel
33
+ ```
34
+
35
+ Build from source:
36
+
37
+ ```bash
38
+ git clone https://github.com/DioNanos/gemini-cli-termux.git
39
+ cd gemini-cli-termux
40
+ npm install --ignore-optional --ignore-scripts
41
+ npm run build && npm run bundle
42
+ node bundle/gemini.js --version
43
+ ```
44
+
45
+ ## Termux Optimizations
46
+
47
+ - **Smart Clipboard:** Auto-detects Android environment to enable seamless
48
+ clipboard operations (fixes `TERMUX__PREFIX`).
49
+ - **Streamlined Install:** Native PTY/keychain deps are **omitted** on Termux
50
+ (fallback to `child_process` + file-based tokens), avoiding native builds.
51
+ - **Clean UX:** Suppresses desktop-centric warnings (like home directory checks)
52
+ to optimize the experience for mobile terminal usage.
53
+ - **ARM64 Native:** Bundled specifically for Android architecture.
54
+
55
+ ## Environment Specifics
56
+
57
+ - **Shell Integration:** Uses robust `child_process` fallback instead of
58
+ `node-pty` for maximum stability on Android.
59
+ - **Credentials:** Keys are stored in standard config files for portability (no
60
+ dependency on system keychains).
61
+ - **Parser:** Simplified Bash parsing to reduce heavy binary dependencies.
62
+
63
+ ## Documentation & Fixes
64
+
65
+ ### 📚 Complete Documentation
66
+
67
+ - **Test Results**
68
+ - [GEMINI_TEST_REPORT_v0.22.7.md](./GEMINI_TEST_REPORT_v0.22.7.md) — testing
69
+ channel
70
+ - [GEMINI_TEST_REPORT_v0.22.2.md](./GEMINI_TEST_REPORT_v0.22.2.md) — stable
71
+ baseline
72
+ - **[Test Suite](./GEMINI_TEST_SUITE.md)** - Test methodology and checklist
73
+ - **[Patches & Fixes](./docs/patches/)** - Known issues and workarounds
74
+
75
+ ### 🔧 Common Issues & Solutions
76
+
77
+ | Issue | Quick Fix | Documentation |
78
+ | --------------------- | ----------------------------- | --------------------------------------------------- |
79
+ | node-pty warning | `export NODE_NO_WARNINGS=1` | [Details](./docs/patches/node-pty-warning.md) |
80
+ | CLI syntax (`--json`) | Use `-o json` instead | [Details](./docs/patches/cli-syntax-differences.md) |
81
+ | Hooks commands | Use interactive mode `/hooks` | [Details](./docs/patches/hooks-interactive-only.md) |
82
+
83
+ ### 📝 Quick Reference
84
+
85
+ ```bash
86
+ # Correct usage examples
87
+ gemini -o json "your prompt" # ✅ JSON output
88
+ gemini --output-format json "prompt" # ✅ Also works
89
+ gemini --json "prompt" # ❌ Wrong syntax
90
+
91
+ # Quiet mode (suppress warnings)
92
+ export NODE_NO_WARNINGS=1
93
+ gemini "your prompt"
94
+
95
+ # Hooks management (interactive only)
96
+ gemini # Start interactive mode
97
+ /hooks # Manage hooks
98
+ ```
99
+
100
+ See [docs/patches/README.md](./docs/patches/README.md) for complete solutions.
101
+
102
+ ## Updating
103
+
104
+ ```bash
105
+ npm install -g @mmmbuto/gemini-cli-termux@latest
106
+ ```
107
+
108
+ ### Versions
109
+
110
+ - **latest / stable**: 0.22.2-termux (default npm dist-tag)
111
+ - **testing**: 0.22.7-termux (adds Gemini 3 Flash preview; install explicitly)
112
+ - **previous**: 0.21.4-termux
113
+
114
+ ## Tests
115
+
116
+ - Suite: [`GEMINI_TEST_SUITE.md`](./GEMINI_TEST_SUITE.md)
117
+ - Latest reports:
118
+ - [`GEMINI_TEST_REPORT_v0.22.7.md`](./GEMINI_TEST_REPORT_v0.22.7.md) — testing
119
+ channel, PASS (static verification) on Termux: version/env, CLI basics,
120
+ non-interactive JSON, Termux-API, context memory, Gemini 3 Flash, agent TOML
121
+ loader, patches integrity. Agent shell security filter blocks complex
122
+ `run_shell_command` calls in this environment (known restriction); CLI
123
+ itself verified via `--version`.
124
+ - [`GEMINI_TEST_REPORT_v0.22.2.md`](./GEMINI_TEST_REPORT_v0.22.2.md) — stable
125
+ baseline, PASS with expected optional-native warnings.
126
+
127
+ ## Termux-API Integration
128
+
129
+ This fork supports optional integration with Termux-API commands for Android
130
+ device access. Enable Gemini to interact with your device hardware and Android
131
+ features.
132
+
133
+ ## Context memory + TTS note:
134
+
135
+ - The Termux fork ships JSON context memory at
136
+ `~/.gemini/context_memory/{base.json,user.json,user.journal.jsonl}`. In
137
+ `/settings → Context Memory` you can toggle autoload, choose the primary
138
+ source, and (if needed) enable writes to `base.json` via
139
+ `Allow Base Memory Writes`.
140
+ - TTS notifications are controlled by
141
+ `/settings → Notifications → Enable TTS Notifications`. When disabled,
142
+ `termux-tts-speak` is blocked even if an agent asks for it. These behaviors
143
+ are merge-safe and confined to Termux patches.
144
+
145
+ ### Quick Setup
146
+
147
+ ```bash
148
+ # Install Termux-API package
149
+ pkg install termux-api jq
150
+
151
+ # Copy tool discovery scripts
152
+ mkdir -p ~/.config/gemini/termux-tools
153
+ cp scripts/termux-tools/*.sh ~/.config/gemini/termux-tools/
154
+
155
+ # Configure in settings
156
+ cat > ~/.config/gemini/settings.json << 'EOF'
157
+ {
158
+ "tool_discovery_command": "bash ~/.config/gemini/termux-tools/discovery.sh",
159
+ "tool_call_command": "bash ~/.config/gemini/termux-tools/call.sh"
160
+ }
161
+ EOF
162
+
163
+ # Test
164
+ gemini "What's my battery status?"
165
+ ```
166
+
167
+ ### Supported Commands
168
+
169
+ Battery, Clipboard, Toast, Notifications, TTS, Vibrate, Torch, WiFi info,
170
+ Location, Camera, Dialog, Share, and more.
171
+
172
+ See [docs/termux-api/](./docs/termux-api/) for complete documentation.
173
+
174
+ ---
175
+
176
+ ## v0.22.7-termux (testing) Highlights
177
+
178
+ - **Gemini 3 Flash preview** enabled (`gemini-3-flash-preview`) with help/docs
179
+ visibility.
180
+
181
+ - **Context Memory (default ON)**: strict, merge-safe JSON memory at
182
+ `~/.gemini/context_memory/{base.json,user.json,user.journal.jsonl}` with
183
+ per-source autoload, primary selector, and GEMINI.md bootstrap on first run.
184
+ - **Deterministic compaction**: journal append-only with incremental offsets,
185
+ closed JSON schemas, key-based upsert, TTL/ephemeral guardrails,
186
+ sensitivity=high excluded from autoload.
187
+ - **Base write toggle**: enable/disable writes to `base.json` from
188
+ `/save_memory target=base` (off by default, merge-safe).
189
+ - **TTS toggle**: new `/settings` switch to allow/block `termux-tts-speak`;
190
+ shell tool blocks TTS when disabled.
191
+ - **Termux-first shell**: non-interactive commands (`echo`, `pwd`, `ls`) work
192
+ without native PTY deps; optional natives removed for faster installs.
193
+ - **Termux-API tools**: discovery/call scripts under `scripts/termux-tools/`
194
+ expose Termux APIs as tools (battery, tts, camera, etc.).
195
+
196
+ See `docs/cli/context-memory.md` for the detailed memory layout and settings.
197
+
198
+ ## v0.22.2-termux Improvements
199
+
200
+ This release includes significant improvements to the Termux experience:
201
+
202
+ ### Installation
203
+
204
+ - **Clear postinstall message** - No more confusion about native module warnings
205
+ - **`make termux-install`** - One-command build from source
206
+ - **`termux-setup.sh`** - Helper script for first-time setup
207
+
208
+ ### Developer Experience
209
+
210
+ - **Termux detection utility** - `isTermux()` and `detectTermuxEnvironment()`
211
+ - **Punycode warning suppression** - Cleaner output on Android
212
+ - **Merge-safe patches** - Easy to maintain after upstream sync
213
+ - **`check-termux-patches.sh`** - Verify patches after merge
214
+
215
+ ### Documentation
216
+
217
+ - Complete Termux-API integration plan
218
+ - 60+ commands documented with parameters
219
+ - Merge strategy guide for maintainers
220
+
221
+ ---
222
+
223
+ ## Changelog (Termux)
224
+
225
+ - **0.22.1-termux**: Termux-API integration, improved installation UX, Termux
226
+ detection utility, merge automation scripts.
227
+ - **0.22.0-termux**: Sync with upstream (0.21.0-nightly); added hide banner
228
+ patch; restored ARM64 dependency.
229
+ - **0.21.4-termux**: (Previous)
230
+
231
+ ## Upstream Tracking
232
+
233
+ - Upstream: https://github.com/google-gemini/gemini-cli
234
+ - Divergent files: `esbuild.config.js`, `docs/TERMUX.md`, `package.json`,
235
+ `README.md`, `test-gemini/*`
236
+
237
+ ## License
238
+
239
+ Apache 2.0 (same as upstream). See LICENSE.
@@ -0,0 +1,97 @@
1
+ # Gemini CLI – Termux Guide
2
+
3
+ How to install and run the Termux edition `@mmmbuto/gemini-cli-termux` on
4
+ Android.
5
+
6
+ ## Prerequisites
7
+
8
+ - Termux installed
9
+ - Node.js 20+ (`pkg install nodejs-lts -y`)
10
+ - Git (only if building from source)
11
+
12
+ ## Install via npm (recommended)
13
+
14
+ ```bash
15
+ npm install -g @mmmbuto/gemini-cli-termux
16
+
17
+ gemini --version
18
+ # expected: 0.22.0-termux (latest)
19
+ ```
20
+
21
+ Features of the npm build
22
+
23
+ - ARM64/Android bundle included
24
+ - Termux clipboard patch (`PREFIX` -> `TERMUX__PREFIX`)
25
+ - Native modules left optional; no NDK required
26
+
27
+ ## Build from source (Termux fork)
28
+
29
+ ```bash
30
+ git clone https://github.com/DioNanos/gemini-cli-termux.git
31
+ cd gemini-cli-termux
32
+ npm install --ignore-optional --ignore-scripts
33
+ npm run build && npm run bundle
34
+ node bundle/gemini.js --version
35
+ ```
36
+
37
+ ## Known issues
38
+
39
+ 1. Native modules (keytar, node-pty, tree-sitter-bash) fail on Termux → ignored
40
+ with the install flags above.
41
+ 2. Clipboardy TERMUX\_\_PREFIX is patched in the bundle.
42
+ 3. Node punycode warning is harmless; optional:
43
+ `node --no-deprecation bundle/gemini.js`.
44
+
45
+ ## Limitations
46
+
47
+ - No full PTY support → some interactive shell features limited
48
+ - No secure keychain → credentials stored in plain config files
49
+ - Bash parsing simplified (no tree-sitter)
50
+
51
+ ## Update
52
+
53
+ - npm: `npm install -g @mmmbuto/gemini-cli-termux@latest`
54
+ - source:
55
+ `git pull && npm install --ignore-optional --ignore-scripts && npm run build && npm run bundle`
56
+
57
+ ## Termux-API Support (Optional)
58
+
59
+ Enable access to Android hardware and APIs:
60
+
61
+ 1. Install Termux-API package:
62
+
63
+ ```bash
64
+ pkg install termux-api jq
65
+ ```
66
+
67
+ 2. Install Termux:API app from F-Droid
68
+
69
+ 3. Setup tool discovery:
70
+
71
+ ```bash
72
+ # Copy scripts to config
73
+ mkdir -p ~/.config/gemini/termux-tools
74
+ cp scripts/termux-tools/*.sh ~/.config/gemini/termux-tools/
75
+ chmod +x ~/.config/gemini/termux-tools/*.sh
76
+
77
+ # Configure in settings.json
78
+ cat > ~/.config/gemini/settings.json << 'EOF'
79
+ {
80
+ "tool_discovery_command": "bash ~/.config/gemini/termux-tools/discovery.sh",
81
+ "tool_call_command": "bash ~/.config/gemini/termux-tools/call.sh"
82
+ }
83
+ EOF
84
+ ```
85
+
86
+ 4. Test:
87
+ ```bash
88
+ gemini "What's my battery status?"
89
+ ```
90
+
91
+ See [docs/termux-api/](./docs/termux-api/) for complete documentation.
92
+
93
+ ## Report Termux issues
94
+
95
+ Use the fork issues: https://github.com/DioNanos/gemini-cli-termux/issues
96
+
97
+ Sunset: will deprecate when upstream adds native Termux support.
@@ -0,0 +1,80 @@
1
+ # Gemini CLI Architecture Overview
2
+
3
+ This document provides a high-level overview of the Gemini CLI's architecture.
4
+
5
+ ## Core components
6
+
7
+ The Gemini CLI is primarily composed of two main packages, along with a suite of
8
+ tools that can be used by the system in the course of handling command-line
9
+ input:
10
+
11
+ 1. **CLI package (`packages/cli`):**
12
+ - **Purpose:** This contains the user-facing portion of the Gemini CLI, such
13
+ as handling the initial user input, presenting the final output, and
14
+ managing the overall user experience.
15
+ - **Key functions contained in the package:**
16
+ - [Input processing](/docs/cli/commands.md)
17
+ - History management
18
+ - Display rendering
19
+ - [Theme and UI customization](/docs/cli/themes.md)
20
+ - [CLI configuration settings](/docs/get-started/configuration.md)
21
+
22
+ 2. **Core package (`packages/core`):**
23
+ - **Purpose:** This acts as the backend for the Gemini CLI. It receives
24
+ requests sent from `packages/cli`, orchestrates interactions with the
25
+ Gemini API, and manages the execution of available tools.
26
+ - **Key functions contained in the package:**
27
+ - API client for communicating with the Google Gemini API
28
+ - Prompt construction and management
29
+ - Tool registration and execution logic
30
+ - State management for conversations or sessions
31
+ - Server-side configuration
32
+
33
+ 3. **Tools (`packages/core/src/tools/`):**
34
+ - **Purpose:** These are individual modules that extend the capabilities of
35
+ the Gemini model, allowing it to interact with the local environment
36
+ (e.g., file system, shell commands, web fetching).
37
+ - **Interaction:** `packages/core` invokes these tools based on requests
38
+ from the Gemini model.
39
+
40
+ ## Interaction flow
41
+
42
+ A typical interaction with the Gemini CLI follows this flow:
43
+
44
+ 1. **User input:** The user types a prompt or command into the terminal, which
45
+ is managed by `packages/cli`.
46
+ 2. **Request to core:** `packages/cli` sends the user's input to
47
+ `packages/core`.
48
+ 3. **Request processed:** The core package:
49
+ - Constructs an appropriate prompt for the Gemini API, possibly including
50
+ conversation history and available tool definitions.
51
+ - Sends the prompt to the Gemini API.
52
+ 4. **Gemini API response:** The Gemini API processes the prompt and returns a
53
+ response. This response might be a direct answer or a request to use one of
54
+ the available tools.
55
+ 5. **Tool execution (if applicable):**
56
+ - When the Gemini API requests a tool, the core package prepares to execute
57
+ it.
58
+ - If the requested tool can modify the file system or execute shell
59
+ commands, the user is first given details of the tool and its arguments,
60
+ and the user must approve the execution.
61
+ - Read-only operations, such as reading files, might not require explicit
62
+ user confirmation to proceed.
63
+ - Once confirmed, or if confirmation is not required, the core package
64
+ executes the relevant action within the relevant tool, and the result is
65
+ sent back to the Gemini API by the core package.
66
+ - The Gemini API processes the tool result and generates a final response.
67
+ 6. **Response to CLI:** The core package sends the final response back to the
68
+ CLI package.
69
+ 7. **Display to user:** The CLI package formats and displays the response to
70
+ the user in the terminal.
71
+
72
+ ## Key design principles
73
+
74
+ - **Modularity:** Separating the CLI (frontend) from the Core (backend) allows
75
+ for independent development and potential future extensions (e.g., different
76
+ frontends for the same backend).
77
+ - **Extensibility:** The tool system is designed to be extensible, allowing new
78
+ capabilities to be added.
79
+ - **User experience:** The CLI focuses on providing a rich and interactive
80
+ terminal experience.
Binary file