karnel-termux 4.7.7 → 4.9.0

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 (215) hide show
  1. package/README.md +46 -5
  2. package/install.sh +2 -2
  3. package/karnel/cli/commands/backup.sh +13 -2
  4. package/karnel/cli/commands/doctor/fixes.sh +111 -13
  5. package/karnel/cli/commands/doctor.sh +112 -10
  6. package/karnel/cli/commands/init.sh +2 -2
  7. package/karnel/cli/commands/install.sh +155 -118
  8. package/karnel/cli/commands/list.sh +106 -13
  9. package/karnel/cli/commands/open.sh +28 -8
  10. package/karnel/cli/commands/reinstall.sh +79 -46
  11. package/karnel/cli/commands/restore.sh +16 -0
  12. package/karnel/cli/commands/robin.sh +656 -0
  13. package/karnel/cli/commands/search.sh +1 -0
  14. package/karnel/cli/commands/show.sh +1 -0
  15. package/karnel/cli/commands/start.sh +12 -2
  16. package/karnel/cli/commands/status.sh +11 -0
  17. package/karnel/cli/commands/uninstall.sh +47 -0
  18. package/karnel/cli/commands/update.sh +43 -0
  19. package/karnel/cli/commands/version.sh +2 -0
  20. package/karnel/cli/commands/voice.sh +11 -6
  21. package/karnel/cli/karnel.sh +115 -69
  22. package/karnel/modules/ai.sh +21 -6
  23. package/karnel/modules/deploy.sh +4 -0
  24. package/karnel/modules/dev.sh +19 -46
  25. package/karnel/modules/games.sh +81 -4
  26. package/karnel/modules/network.sh +88 -0
  27. package/karnel/modules/osint.sh +123 -0
  28. package/karnel/modules/shell.sh +1 -1
  29. package/karnel/modules/ui.sh +4 -0
  30. package/karnel/modules/utils.sh +88 -0
  31. package/karnel/modules/voice.sh +8 -2
  32. package/karnel/tools/ai/all.sh +1 -0
  33. package/karnel/tools/ai/antigravity-cli/install.sh +0 -0
  34. package/karnel/tools/ai/claude-code/install.sh +0 -0
  35. package/karnel/tools/ai/cline/install.sh +8 -8
  36. package/karnel/tools/ai/codegraph/install.sh +8 -5
  37. package/karnel/tools/ai/codex/install.sh +0 -0
  38. package/karnel/tools/ai/command-code/install.sh +0 -0
  39. package/karnel/tools/ai/copilot-termux/install.sh +0 -0
  40. package/karnel/tools/ai/crush/install.sh +1 -1
  41. package/karnel/tools/ai/ctx7/install.sh +0 -0
  42. package/karnel/tools/ai/engram/install.sh +5 -2
  43. package/karnel/tools/ai/freebuff/install.sh +0 -0
  44. package/karnel/tools/ai/gemini-cli/install.sh +0 -0
  45. package/karnel/tools/ai/gentle-ai/install.sh +1 -1
  46. package/karnel/tools/ai/hermes-agent/install.sh +0 -0
  47. package/karnel/tools/ai/kilocode-cli/install.sh +0 -0
  48. package/karnel/tools/ai/kimchi-code/install.sh +3 -1
  49. package/karnel/tools/ai/kimi-code/install.sh +0 -0
  50. package/karnel/tools/ai/kiro/install.sh +0 -0
  51. package/karnel/tools/ai/mimocode/install.sh +0 -0
  52. package/karnel/tools/ai/minimax-cli/install.sh +0 -0
  53. package/karnel/tools/ai/mistral-vibe/install.sh +0 -0
  54. package/karnel/tools/ai/odysseus/install.sh +0 -0
  55. package/karnel/tools/ai/ollama/install.sh +0 -0
  56. package/karnel/tools/ai/omni-route/install.sh +1 -1
  57. package/karnel/tools/ai/openclaude/install.sh +0 -0
  58. package/karnel/tools/ai/openclaw/install.sh +0 -0
  59. package/karnel/tools/ai/opencode/install.sh +0 -0
  60. package/karnel/tools/ai/openspec/install.sh +0 -0
  61. package/karnel/tools/ai/pi/install.sh +0 -0
  62. package/karnel/tools/ai/qoder/README.md +50 -0
  63. package/karnel/tools/ai/qoder/bin/qodercli +28 -0
  64. package/karnel/tools/ai/qoder/helper/qoder_helper.c +47 -0
  65. package/karnel/tools/ai/qoder/install.sh +367 -0
  66. package/karnel/tools/ai/qwen-code/install.sh +0 -0
  67. package/karnel/tools/auto/all.sh +1 -1
  68. package/karnel/tools/auto/n8n/install.sh +0 -0
  69. package/karnel/tools/db/all.sh +1 -1
  70. package/karnel/tools/db/mariadb/install.sh +0 -0
  71. package/karnel/tools/db/mongodb/install.sh +0 -0
  72. package/karnel/tools/db/postgresql/install.sh +0 -0
  73. package/karnel/tools/db/sqlite/install.sh +0 -0
  74. package/karnel/tools/deploy/all.sh +2 -2
  75. package/karnel/tools/deploy/netlify/install.sh +0 -0
  76. package/karnel/tools/deploy/railway/install.sh +1 -1
  77. package/karnel/tools/deploy/vercel/install.sh +0 -0
  78. package/karnel/tools/dev/all.sh +36 -13
  79. package/karnel/tools/dev/bat/install.sh +0 -0
  80. package/karnel/tools/dev/bc/install.sh +0 -0
  81. package/karnel/tools/dev/cloudflared/install.sh +0 -0
  82. package/karnel/tools/dev/curl/install.sh +0 -0
  83. package/karnel/tools/dev/fzf/install.sh +36 -9
  84. package/karnel/tools/dev/gh/install.sh +0 -0
  85. package/karnel/tools/dev/html2text/install.sh +0 -0
  86. package/karnel/tools/dev/imagemagick/install.sh +0 -0
  87. package/karnel/tools/dev/jq/install.sh +0 -0
  88. package/karnel/tools/dev/lsd/install.sh +0 -0
  89. package/karnel/tools/dev/make/install.sh +0 -0
  90. package/karnel/tools/dev/ncurses/install.sh +0 -0
  91. package/karnel/tools/dev/proot/install.sh +0 -0
  92. package/karnel/tools/dev/shfmt/install.sh +0 -0
  93. package/karnel/tools/dev/snyk/install.sh +0 -0
  94. package/karnel/tools/dev/tmate/install.sh +0 -0
  95. package/karnel/tools/dev/translate/install.sh +0 -0
  96. package/karnel/tools/dev/tree/install.sh +0 -0
  97. package/karnel/tools/dev/udocker/install.sh +0 -0
  98. package/karnel/tools/dev/wget/install.sh +0 -0
  99. package/karnel/tools/editor/all.sh +1 -1
  100. package/karnel/tools/editor/code-server/install.sh +0 -0
  101. package/karnel/tools/games/all.sh +1 -1
  102. package/karnel/tools/games/arcade/install.sh +0 -0
  103. package/karnel/tools/games/buzz/install.sh +0 -0
  104. package/karnel/tools/games/ctfgod/install.sh +0 -0
  105. package/karnel/tools/games/detective/install.sh +0 -0
  106. package/karnel/tools/games/pet-friends/install.sh +0 -0
  107. package/karnel/tools/games/tamagotchi/install.sh +0 -0
  108. package/karnel/tools/lang/all.sh +2 -1
  109. package/karnel/tools/lang/bun/bin/bun +27 -0
  110. package/karnel/tools/lang/bun/install.sh +318 -0
  111. package/karnel/tools/lang/bun/src/bun-shim.c +352 -0
  112. package/karnel/tools/lang/bun/src/bun_wrapper.c +55 -0
  113. package/karnel/tools/lang/clang/install.sh +0 -0
  114. package/karnel/tools/lang/golang/install.sh +0 -0
  115. package/karnel/tools/lang/nodejs/install.sh +0 -0
  116. package/karnel/tools/lang/perl/install.sh +0 -0
  117. package/karnel/tools/lang/php/install.sh +0 -0
  118. package/karnel/tools/lang/python/install.sh +0 -0
  119. package/karnel/tools/lang/rust/install.sh +0 -0
  120. package/karnel/tools/network/all.sh +65 -0
  121. package/karnel/tools/network/dark/README.md +45 -0
  122. package/karnel/tools/network/dark/dark.py +709 -0
  123. package/karnel/tools/network/dark/install.sh +51 -0
  124. package/karnel/tools/network/dedsec-network/README.md +42 -0
  125. package/karnel/tools/network/dedsec-network/dedsec-network.py +709 -0
  126. package/karnel/tools/network/dedsec-network/install.sh +50 -0
  127. package/karnel/tools/npm/all.sh +1 -1
  128. package/karnel/tools/npm/live-server/install.sh +0 -0
  129. package/karnel/tools/npm/localtunnel/install.sh +0 -0
  130. package/karnel/tools/npm/markserv/install.sh +0 -0
  131. package/karnel/tools/npm/ncu/install.sh +0 -0
  132. package/karnel/tools/npm/nestjs/install.sh +0 -0
  133. package/karnel/tools/npm/ngrok/install.sh +0 -0
  134. package/karnel/tools/npm/prettier/install.sh +0 -0
  135. package/karnel/tools/npm/psqlformat/install.sh +0 -0
  136. package/karnel/tools/npm/turbopack/install.sh +2 -0
  137. package/karnel/tools/npm/typescript/install.sh +0 -0
  138. package/karnel/tools/npm/vercel/install.sh +0 -0
  139. package/karnel/tools/osint/all.sh +65 -0
  140. package/karnel/tools/osint/robin/README.md +99 -0
  141. package/karnel/tools/osint/robin/common.sh +258 -0
  142. package/karnel/tools/osint/robin/install.sh +548 -0
  143. package/karnel/tools/osint/robin/requirements-termux.txt +33 -0
  144. package/karnel/tools/shell/all.sh +1 -1
  145. package/karnel/tools/shell/better-npm/install.sh +0 -0
  146. package/karnel/tools/shell/fzf-tab/install.sh +0 -0
  147. package/karnel/tools/shell/history-substring/install.sh +0 -0
  148. package/karnel/tools/shell/powerlevel10k/install.sh +0 -0
  149. package/karnel/tools/shell/you-should-use/install.sh +0 -0
  150. package/karnel/tools/shell/zsh-autopair/install.sh +0 -0
  151. package/karnel/tools/shell/zsh-autosuggestions/install.sh +0 -0
  152. package/karnel/tools/shell/zsh-completions/install.sh +0 -0
  153. package/karnel/tools/shell/zsh-defer/install.sh +0 -0
  154. package/karnel/tools/shell/zsh-syntax-highlighting/install.sh +0 -0
  155. package/karnel/tools/ui/all.sh +1 -1
  156. package/karnel/tools/ui/banner/install.sh +0 -0
  157. package/karnel/tools/ui/cursor/install.sh +0 -0
  158. package/karnel/tools/ui/extra-keys/install.sh +0 -0
  159. package/karnel/tools/ui/font/install.sh +0 -0
  160. package/karnel/tools/utils/all.sh +88 -0
  161. package/karnel/tools/utils/applaunch/README.md +43 -0
  162. package/karnel/tools/{dev → utils}/applaunch/install.sh +3 -3
  163. package/karnel/tools/utils/fconv/README.md +41 -0
  164. package/karnel/tools/{dev → utils}/fconv/install.sh +3 -3
  165. package/karnel/tools/utils/filecheck/README.md +41 -0
  166. package/karnel/tools/{dev → utils}/filecheck/install.sh +3 -3
  167. package/karnel/tools/utils/httptmux/README.md +42 -0
  168. package/karnel/tools/{dev → utils}/httptmux/install.sh +0 -0
  169. package/karnel/tools/utils/notes/README.md +41 -0
  170. package/karnel/tools/{dev → utils}/notes/install.sh +3 -3
  171. package/karnel/tools/utils/passman/README.md +42 -0
  172. package/karnel/tools/{dev → utils}/passman/install.sh +3 -3
  173. package/karnel/tools/utils/qrcode/README.md +41 -0
  174. package/karnel/tools/utils/qrcode/install.sh +50 -0
  175. package/karnel/tools/utils/qrcode/qrcode.py +89 -0
  176. package/karnel/tools/utils/splash/README.md +41 -0
  177. package/karnel/tools/{dev → utils}/splash/install.sh +3 -3
  178. package/karnel/tools/utils/treex/README.md +41 -0
  179. package/karnel/tools/{dev → utils}/treex/install.sh +3 -3
  180. package/karnel/tools/utils/websites/README.md +41 -0
  181. package/karnel/tools/{dev → utils}/websites/install.sh +3 -3
  182. package/karnel/tools/utils/zork/README.md +43 -0
  183. package/karnel/tools/{dev → utils}/zork/install.sh +3 -3
  184. package/karnel/utils/banner.sh +8 -6
  185. package/karnel/utils/bootstrap.sh +1 -1
  186. package/karnel/utils/env.sh +16 -2
  187. package/karnel/utils/log.sh +0 -1
  188. package/karnel/utils/tools.sh +9 -2
  189. package/package.json +6 -1
  190. package/scripts/check-package.js +45 -0
  191. package/scripts/completion.bash +8 -3
  192. package/scripts/completion.zsh +8 -13
  193. package/karnel/cli/commands/doctor/system.sh +0 -87
  194. package/karnel/tools/dev/applaunch/__pycache__/applaunch.cpython-314.pyc +0 -0
  195. package/karnel/tools/dev/fconv/__pycache__/fconv.cpython-314.pyc +0 -0
  196. package/karnel/tools/dev/filecheck/__pycache__/filecheck.cpython-314.pyc +0 -0
  197. package/karnel/tools/dev/notes/__pycache__/notes.cpython-314.pyc +0 -0
  198. package/karnel/tools/dev/passman/__pycache__/passman.cpython-314.pyc +0 -0
  199. package/karnel/tools/dev/splash/__pycache__/splash.cpython-314.pyc +0 -0
  200. package/karnel/tools/dev/websites/__pycache__/websites.cpython-314.pyc +0 -0
  201. package/karnel/tools/games/arcade/__pycache__/arcade.cpython-314.pyc +0 -0
  202. package/karnel/tools/games/buzz/__pycache__/buzz.cpython-314.pyc +0 -0
  203. package/karnel/tools/games/ctfgod/__pycache__/ctfgod.cpython-314.pyc +0 -0
  204. package/karnel/tools/games/detective/__pycache__/detective.cpython-314.pyc +0 -0
  205. package/karnel/tools/games/pet-friends/__pycache__/pet-friends.cpython-314.pyc +0 -0
  206. package/karnel/tools/games/tamagotchi/__pycache__/tamagotchi.cpython-314.pyc +0 -0
  207. package/karnel/tools/games/terminal-arcade/__pycache__/terminal-arcade.cpython-314.pyc +0 -0
  208. /package/karnel/tools/{dev → utils}/applaunch/applaunch.py +0 -0
  209. /package/karnel/tools/{dev → utils}/fconv/fconv.py +0 -0
  210. /package/karnel/tools/{dev → utils}/filecheck/filecheck.py +0 -0
  211. /package/karnel/tools/{dev → utils}/notes/notes.py +0 -0
  212. /package/karnel/tools/{dev → utils}/passman/passman.py +0 -0
  213. /package/karnel/tools/{dev → utils}/splash/splash.py +0 -0
  214. /package/karnel/tools/{dev → utils}/treex/treex.py +0 -0
  215. /package/karnel/tools/{dev → utils}/websites/websites.py +0 -0
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  <p align="center">
10
10
  <a href="https://github.com/israelmarques1024-dotcom/karnel-termux">
11
- <img src="https://img.shields.io/badge/version-4.7.6-0078D4?style=for-the-badge" alt="Version">
11
+ <img src="https://img.shields.io/badge/version-4.9.0-0078D4?style=for-the-badge" alt="Version">
12
12
  </a>
13
13
  <a href="https://www.npmjs.com/package/karnel-termux">
14
14
  <img src="https://img.shields.io/npm/v/karnel-termux?style=for-the-badge&logo=npm&color=cb3837" alt="npm">
@@ -36,8 +36,11 @@ Created by **Israel Marques**.
36
36
  - **31 AI agents** for coding — Claude, Gemini, OpenCode, Ollama, Cline, karnelRoute and more
37
37
  - **7 languages** — Node.js, Python, Go, Rust, C/C++, PHP, Perl
38
38
  - **5 databases** — PostgreSQL, MariaDB, SQLite, MongoDB, Redis
39
- - **24 dev tools** — gh, curl, fzf, bat, lsd, jq, tmux, openssh, snyk and more
39
+ - **22 dev tools** — gh, curl, fzf, bat, lsd, jq, tmux, openssh, snyk and more
40
+ - **11 utility scripts** — fconv, notes, treex, qrcode, zork and more
41
+ - **2 network tools** — dark, dedsec-network
40
42
  - **3 deploy CLIs** — Vercel, Railway, Netlify
43
+ - **Responsible OSINT** — Robin v2.8 through Tor with a loopback-only web UI
41
44
  - **Professional editor** — code-server (VS Code in browser)
42
45
  - **Second brain** — Memory system with AI search and idea graph
43
46
  - **Voice commands** — Speak to your AI agents
@@ -92,6 +95,7 @@ karnel
92
95
  | `karnel reinstall <module>` | Reinstall modules |
93
96
  | `karnel doctor termux` | Diagnose the Termux environment (30+ sections) |
94
97
  | `karnel doctor code` | Detect project ecosystems and run code checks |
98
+ | `karnel doctor robin` | Diagnose Robin, Tor, dependencies, and local UI |
95
99
  | `karnel brain` | Second brain — memories and search |
96
100
  | `karnel env` | Manage environment variables |
97
101
  | `karnel voice` | Voice commands for AI agents |
@@ -99,6 +103,7 @@ karnel
99
103
  | `karnel pg` | PostgreSQL manager |
100
104
  | `karnel init <template>` | Initialize projects with templates |
101
105
  | `karnel deploy` | Deploy projects (Vercel, Railway, Netlify) |
106
+ | `karnel robin` | Manage the Robin OSINT service |
102
107
  | `karnel --version` | Show installed version |
103
108
 
104
109
  ### Modules
@@ -115,6 +120,38 @@ karnel
115
120
  | `ui` | Font, cursor, extra-keys, banner | `karnel install ui` |
116
121
  | `auto` | Automation with n8n | `karnel install auto` |
117
122
  | `deploy` | Vercel, Railway, Netlify | `karnel install deploy` |
123
+ | `games` | Buzz, CTF God, Detective, Tamagotchi and more | `karnel install games` |
124
+ | `network` | Dark Web OSINT, DedSec Network Toolkit | `karnel install network` |
125
+ | `utils` | fconv, notes, treex, passman, applaunch, qrcode, zork and more | `karnel install utils` |
126
+ | `osint` | Robin v2.8, Tor, Streamlit, and LLM providers | `karnel install osint` |
127
+ | `voice` | Speech-to-agent through Termux:API | `karnel install voice` |
128
+
129
+ ---
130
+
131
+ ## Robin OSINT
132
+
133
+ Robin is an independent AI-assisted dark-web OSINT project. Karnel pins the
134
+ tested `v2.8` release, installs native Termux scientific dependencies, binds the
135
+ web interface only to `127.0.0.1`, and keeps application code separate from
136
+ provider configuration and saved investigations.
137
+
138
+ ```bash
139
+ karnel install osint --robin
140
+ karnel robin config
141
+ karnel robin start
142
+ karnel robin doctor --network
143
+ ```
144
+
145
+ Open `http://127.0.0.1:8501` only after the health check succeeds. Use Robin
146
+ solely for lawful, authorized, and ethical research. Tor does not guarantee
147
+ anonymity, external LLM traffic normally bypasses Tor, providers may process
148
+ submitted data, and AI output is not verified evidence.
149
+
150
+ Uninstall and reinstall preserve `$KARNEL_CONFIG/robin/.env` and
151
+ `$KARNEL_DATA/robin/investigations`. Permanent deletion requires the explicit
152
+ `karnel robin purge-data` command.
153
+
154
+ See the bundled reference with `karnel show osint --robin`.
118
155
 
119
156
  ---
120
157
 
@@ -157,7 +194,7 @@ karnel install ai --opencode --ollama # Install specific agents
157
194
  | **Odysseus** | `--odysseus` | Odysseus coding assistant |
158
195
  | **Kimchi CLI** | `--kimchi-code` | Kimchi AI agent |
159
196
  | **Cline CLI** | `--cline` | Autonomous coding agent (via proot-distro) |
160
- | **karnelRoute** | `--karnel-route` | AI Gateway with 236+ providers |
197
+ | **omniRoute** | `--omni-route` | AI gateway with 236+ providers |
161
198
  | **Context7** | `--ctx7` | Documentation for AI assistants |
162
199
  | **OpenSpec** | `--openspec` | Spec-Driven Development |
163
200
  | **Copilot-Termux** | `--copilot-termux` | GitHub Copilot CLI adapted for Termux |
@@ -168,7 +205,7 @@ karnel install ai --opencode --ollama # Install specific agents
168
205
 
169
206
  ## karnel doctor
170
207
 
171
- Doctor has exactly two operational subcommands:
208
+ Doctor has three operational subcommands:
172
209
 
173
210
  ```bash
174
211
  karnel doctor termux # 30+ Termux/Karnel diagnostic sections
@@ -179,6 +216,8 @@ karnel doctor code # Quick project analysis
179
216
  karnel doctor code --standard . # Add security, deps, coverage and complexity
180
217
  karnel doctor code --deep --json . # All 76 definitions as standalone JSON
181
218
  karnel doctor code --fix . # Apply fixes classified as safe
219
+ karnel doctor robin # Robin/Tor/dependency diagnostics
220
+ karnel doctor robin --network # Also verify traffic through Tor
182
221
  ```
183
222
 
184
223
  Running `karnel doctor` without a subcommand defaults to `termux`.
@@ -393,12 +432,14 @@ karnel/
393
432
  │ │ ├── ai/ # 31 AI agents
394
433
  │ │ ├── lang/ # Languages
395
434
  │ │ ├── db/ # Databases
396
- │ │ ├── dev/ # Dev tools
435
+ │ │ ├── dev/ # 22 dev tools
397
436
  │ │ ├── editor/ # Code editor
398
437
  │ │ ├── npm/ # Global npm packages
399
438
  │ │ ├── shell/ # ZSH plugins
400
439
  │ │ ├── ui/ # Termux interface
401
440
  │ │ ├── auto/ # Automation
441
+ │ │ ├── network/ # 2 network tools
442
+ │ │ ├── utils/ # 11 utility tools
402
443
  │ │ └── deploy/ # Deploy CLIs
403
444
  │ └── utils/ # Utilities (banner, log, env, etc.)
404
445
  ├── install.sh # Installation script
package/install.sh CHANGED
@@ -111,8 +111,8 @@ bootstrap_dependencies() {
111
111
 
112
112
  if [[ $needed_tput -eq 1 ]]; then
113
113
  echo -e " ${P_BORDER}→${P_NC} Installing ncurses-utils..."
114
- pkg install -y ncurses-utils &>/dev/null
115
- echo -e " ${P_OK}✔${P_NC} ncurses-utils installed"
114
+ pkg install -y ncurses &>/dev/null
115
+ echo -e " ${P_OK}✔${P_NC} ncurses installed"
116
116
  echo
117
117
  fi
118
118
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  import "@/utils/log"
4
4
  import "@/utils/colors"
5
+ import "@/tools/osint/robin/common"
5
6
 
6
7
  backup_main() {
7
8
  if [[ "$1" == "--help" || "$1" == "-h" ]]; then
@@ -46,7 +47,7 @@ backup_main() {
46
47
  local tool
47
48
  tool=$(basename "${t%/}")
48
49
  local bins
49
- bins=$(grep "\"$tool:" "$m/all.sh" 2>/dev/null | cut -d: -f3 | tr -d '"')
50
+ bins=$(grep -F "\"$tool:" "$m/all.sh" 2>/dev/null | cut -d: -f3 | tr -d '"')
50
51
  local found=false
51
52
  for b in ${bins//,/ }; do
52
53
  command -v "$b" &>/dev/null && found=true && break
@@ -78,14 +79,24 @@ backup_main() {
78
79
  fi
79
80
  fi
80
81
  done
82
+ # Robin API keys and investigations are intentionally excluded from ordinary,
83
+ # unencrypted backups. The acknowledgement file is harmless to retain.
84
+ if [[ "$ROBIN_CONFIG_DIR" == "$HOME/.config/"* ]]; then
85
+ local robin_config_relative="${ROBIN_CONFIG_DIR#"$HOME/.config/"}"
86
+ rm -f "$tmp/config/config/$robin_config_relative"/.env* 2>/dev/null
87
+ fi
88
+ find "$tmp/config/config" -type f -path '*/karnel/robin/.env*' -delete 2>/dev/null
81
89
  [[ -f "$PREFIX/etc/apt/sources.list" ]] && cp "$PREFIX/etc/apt/sources.list" "$tmp/config/prefix-etc/" 2>/dev/null
82
90
 
83
91
  tar -czf "$file" -C "$tmp" . 2>/dev/null
84
92
  rm -rf "$tmp"
85
93
 
86
- local size
94
+ local size checksum
87
95
  size=$(du -h "$file" | awk '{print $1}')
96
+ checksum=$(sha256sum "$file" | awk '{print $1}')
97
+ echo "$checksum" > "$file.sha256"
88
98
  log_success "Backup: $(basename "$file") ($size)"
99
+ log_success "Checksum (SHA256): ${checksum:0:16}...${checksum: -16}"
89
100
 
90
101
  # Cloud
91
102
  if $cloud; then
@@ -134,6 +134,7 @@ _fix_banner() {
134
134
 
135
135
  $marker
136
136
  source "$KARNEL_UTILS/banner.sh"
137
+ render_banner
137
138
  EOF
138
139
  return 0
139
140
  fi
@@ -273,19 +274,6 @@ _fix_proot_ubuntu() {
273
274
  return 1
274
275
  }
275
276
 
276
- _fix_dns() {
277
- if command -v nslookup &>/dev/null && nslookup github.com &>/dev/null; then
278
- return 0
279
- fi
280
- local resolv_conf="$PREFIX/etc/resolv.conf"
281
- if [[ -w "$resolv_conf" ]] || [[ -w "$PREFIX/etc" ]]; then
282
- cp "$resolv_conf" "${resolv_conf}.bak" 2>/dev/null
283
- echo 'nameserver 8.8.8.8' > "$resolv_conf" 2>/dev/null && return 0
284
- echo 'nameserver 8.8.4.4' >> "$resolv_conf" 2>/dev/null || true
285
- fi
286
- return 1
287
- }
288
-
289
277
  _fix_mirror() {
290
278
  if command -v termux-change-repo &>/dev/null; then
291
279
  termux-change-repo 2>/dev/null
@@ -325,3 +313,113 @@ _fix_url_quote_magic() {
325
313
  "$uqm_file" 2>/dev/null
326
314
  return $?
327
315
  }
316
+
317
+ # ===== SCRIPT KEEPER FIX CALLBACKS =====
318
+
319
+ _fix_script_symlinks() {
320
+ local fixed=0 module_dir tool_dir
321
+ while IFS= read -r -d '' module_dir; do
322
+ while IFS= read -r -d '' tool_dir; do
323
+ local installer="$tool_dir/install.sh"
324
+ [[ -f "$installer" ]] || continue
325
+ local tool_name
326
+ tool_name=$(basename "$tool_dir")
327
+ local bin_names
328
+ bin_names=$(grep -E '^local BIN_NAME=' "$installer" 2>/dev/null | head -1 | sed "s/.*BIN_NAME=\"\?//;s/\"\?$//")
329
+ [[ -z "$bin_names" ]] && bin_names="$tool_name"
330
+ for bin_name in $bin_names; do
331
+ local expected="$tool_dir/$bin_name.py"
332
+ local link="$PREFIX/bin/$bin_name"
333
+ if [[ -L "$link" ]]; then
334
+ local target
335
+ target=$(readlink "$link")
336
+ if [[ "$target" != "$expected" ]]; then
337
+ ln -sf "$expected" "$link" 2>/dev/null && ((fixed++))
338
+ fi
339
+ fi
340
+ done
341
+ done < <(find "$module_dir" -mindepth 1 -maxdepth 1 -type d -print0 2>/dev/null || true)
342
+ done < <(find "$KARNEL_PATH/tools/" -mindepth 1 -maxdepth 1 -type d -print0 2>/dev/null || true)
343
+ [[ $fixed -gt 0 ]] && log_success "Fixed $fixed symlink(s)"
344
+ return 0
345
+ }
346
+
347
+ _fix_script_shebangs() {
348
+ local fixed=0 f
349
+ while IFS= read -r -d '' f; do
350
+ local shebang
351
+ shebang=$(head -1 "$f" 2>/dev/null | tr -d '\0')
352
+ case "$shebang" in
353
+ "#!/usr/bin/env node")
354
+ sed -i "1s|^.*$|#!$PREFIX/bin/node|" "$f" && ((fixed++)) ;;
355
+ "#!/usr/bin/env bash"|"#!/usr/bin/env sh")
356
+ sed -i "1s|^.*$|#!$PREFIX/bin/bash|" "$f" && ((fixed++)) ;;
357
+ "#!/usr/bin/env python3"|"#!/usr/bin/env python")
358
+ sed -i "1s|^.*$|#!$PREFIX/bin/python3|" "$f" && ((fixed++)) ;;
359
+ esac
360
+ done < <(find "$PREFIX/bin" -maxdepth 1 -type f -print0 2>/dev/null || true)
361
+ [[ $fixed -gt 0 ]] && log_success "Fixed $fixed shebang(s)"
362
+ return 0
363
+ }
364
+
365
+ _fix_script_perms() {
366
+ local fixed=0 script module_dir tool_dir
367
+ while IFS= read -r -d '' module_dir; do
368
+ while IFS= read -r -d '' tool_dir; do
369
+ while IFS= read -r -d '' script; do
370
+ [[ -x "$script" ]] || { chmod +x "$script" 2>/dev/null && ((fixed++)); }
371
+ done < <(find "$tool_dir" -maxdepth 1 -type f \( -name '*.py' -o -name '*.sh' \) -print0 2>/dev/null || true)
372
+ done < <(find "$module_dir" -mindepth 1 -maxdepth 1 -type d -print0 2>/dev/null || true)
373
+ done < <(find "$KARNEL_PATH/tools/" -mindepth 1 -maxdepth 1 -type d -print0 2>/dev/null || true)
374
+ [[ $fixed -gt 0 ]] && log_success "Fixed $fixed script permission(s)"
375
+ return 0
376
+ }
377
+
378
+ _fix_script_missing() {
379
+ local fixed=0 total=0 module_dir tool_dir
380
+ while IFS= read -r -d '' module_dir; do
381
+ while IFS= read -r -d '' tool_dir; do
382
+ local installer="$tool_dir/install.sh"
383
+ [[ -f "$installer" ]] || continue
384
+ local tool_name
385
+ tool_name=$(basename "$tool_dir")
386
+ local module_name
387
+ module_name=$(basename "$module_dir")
388
+ local bin_names
389
+ bin_names=$(grep -E '^local BIN_NAME=' "$installer" 2>/dev/null | head -1 | sed "s/.*BIN_NAME=\"\?//;s/\"\?$//")
390
+ [[ -z "$bin_names" ]] && bin_names="$tool_name"
391
+ for bin_name in $bin_names; do
392
+ ((total++))
393
+ if ! command -v "$bin_name" &>/dev/null; then
394
+ karnel install "$module_name" "--$tool_name" &>/dev/null && ((fixed++))
395
+ fi
396
+ done
397
+ done < <(find "$module_dir" -mindepth 1 -maxdepth 1 -type d -print0 2>/dev/null || true)
398
+ done < <(find "$KARNEL_PATH/tools/" -mindepth 1 -maxdepth 1 -type d -print0 2>/dev/null || true)
399
+ [[ $fixed -gt 0 ]] && log_success "Reinstalled $fixed/$total missing tool(s)"
400
+ return 0
401
+ }
402
+
403
+ _fix_script_stale() {
404
+ local removed=0 bin_link
405
+ while IFS= read -r -d '' bin_link; do
406
+ if [[ -L "$bin_link" ]]; then
407
+ local target
408
+ target=$(readlink "$bin_link")
409
+ if echo "$target" | grep -q "$KARNEL_PATH/tools/" && [[ ! -f "$target" ]]; then
410
+ rm -f "$bin_link" 2>/dev/null && ((removed++))
411
+ fi
412
+ fi
413
+ done < <(find "$PREFIX/bin" -maxdepth 1 -print0 2>/dev/null || true)
414
+ [[ $removed -gt 0 ]] && log_success "Removed $removed stale symlink(s)"
415
+ return 0
416
+ }
417
+
418
+ _fix_keyring() {
419
+ pkg update -y &>/dev/null && pkg install -y termux-keyring &>/dev/null
420
+ }
421
+
422
+ _fix_apt_cache() {
423
+ rm -rf "$PREFIX/var/apt/lists"/* 2>/dev/null
424
+ pkg update -y &>/dev/null
425
+ }
@@ -17,6 +17,12 @@ doctor_main() {
17
17
  shift
18
18
  doctor_code "$@"
19
19
  ;;
20
+ robin)
21
+ shift
22
+ import "@/cli/commands/robin"
23
+ _robin_print_disclaimer
24
+ _robin_doctor "$@"
25
+ ;;
20
26
  --quick|-q)
21
27
  log_warn "Deprecated: use ${D_CYAN}karnel doctor termux --quick${NC}"
22
28
  doctor_termux "$@"
@@ -47,6 +53,7 @@ doctor_help() {
47
53
  echo
48
54
  printf " ${D_CYAN}%-16s${NC} %s\n" "termux" "Diagnose Termux environment (full system check)"
49
55
  printf " ${D_CYAN}%-16s${NC} %s\n" "code" "Analyze project code structure and tools"
56
+ printf " ${D_CYAN}%-16s${NC} %s\n" "robin" "Diagnose Robin, Tor, dependencies, and local UI"
50
57
  echo
51
58
  separator_section "Termux Options"
52
59
  echo
@@ -57,6 +64,7 @@ doctor_help() {
57
64
  list_item "${D_CYAN}karnel doctor${NC} — Termux diagnostics (default)"
58
65
  list_item "${D_CYAN}karnel doctor termux --quick${NC} — Quick diagnostics"
59
66
  list_item "${D_CYAN}karnel doctor code${NC} — Analyze current project"
67
+ list_item "${D_CYAN}karnel doctor robin${NC} — Diagnose Robin locally"
60
68
  list_item "${D_CYAN}karnel doctor termux --fix${NC} — Diagnose + auto-fix"
61
69
  echo
62
70
  }
@@ -633,7 +641,110 @@ doctor_termux() {
633
641
  ((warnings++))
634
642
  fi
635
643
 
636
- # ===== SHEBANG & BINARY HEALTH =====
644
+ # ===== SCRIPT KEEPER =====
645
+ echo
646
+ separator_section "Script Keeper — Karnel-managed Script Audit"
647
+ echo
648
+
649
+ local script_ok=0 script_warn=0 script_err=0
650
+ local found_symlink_issues=false found_shebang_issues=false
651
+ local found_perm_issues=false found_missing_issues=false found_stale_issues=false
652
+
653
+ for module_dir in "$KARNEL_PATH/tools/"*/; do
654
+ local module_name
655
+ module_name=$(basename "${module_dir%/}")
656
+ for tool_dir in "$module_dir"*/; do
657
+ [[ -d "$tool_dir" ]] || continue
658
+ local tool_name
659
+ tool_name=$(basename "${tool_dir%/}")
660
+ local installer="$tool_dir/install.sh"
661
+ [[ -f "$installer" ]] || continue
662
+
663
+ local bin_names
664
+ bin_names=$(grep -E '^local BIN_NAME=' "$installer" 2>/dev/null | head -1 | sed "s/.*BIN_NAME=\"\?//;s/\"\?$//")
665
+ [[ -z "$bin_names" ]] && bin_names="$tool_name"
666
+
667
+ for bin_name in $bin_names; do
668
+ local bin_path="$PREFIX/bin/$bin_name"
669
+ local tool_script="$tool_dir/$bin_name.py"
670
+
671
+ if [[ -L "$bin_path" ]]; then
672
+ local target
673
+ target=$(readlink "$bin_path")
674
+ if [[ "$target" == "$tool_script" ]]; then
675
+ log_success "$module_name/$tool_name → $bin_name (OK)"
676
+ ((script_ok++))
677
+ else
678
+ log_warn "$bin_name: symlink target changed (→ $target, expected $tool_script)"
679
+ ((script_warn++)); found_symlink_issues=true
680
+ fi
681
+
682
+ if [[ -f "$bin_path" ]] && head -1 "$bin_path" 2>/dev/null | grep -q "^#!/usr/bin/env"; then
683
+ log_warn "$bin_name: uses #!/usr/bin/env — will fail on Termux"
684
+ ((script_warn++)); found_shebang_issues=true
685
+ fi
686
+
687
+ if [[ -f "$tool_script" ]]; then
688
+ local perms
689
+ perms=$(stat -c "%a" "$tool_script" 2>/dev/null)
690
+ if [[ "$perms" != "755" ]] && [[ "$perms" != "555" ]] && [[ "$perms" != "775" ]]; then
691
+ log_warn "$bin_name: script permissions $perms (should be 755)"
692
+ ((script_warn++)); found_perm_issues=true
693
+ fi
694
+ fi
695
+ elif [[ -f "$bin_path" ]]; then
696
+ log_info "$bin_name: standalone binary (not Karnel-managed)"
697
+ else
698
+ log_warn "$module_name/$tool_name: $bin_name not found in PATH"
699
+ ((script_warn++)); found_missing_issues=true
700
+ fi
701
+ done
702
+ done
703
+ done
704
+
705
+ for bin_link in "$PREFIX/bin"/*; do
706
+ if [[ -L "$bin_link" ]]; then
707
+ local target
708
+ target=$(readlink "$bin_link")
709
+ if echo "$target" | grep -q "$KARNEL_PATH/tools/" && [[ ! -f "$target" ]]; then
710
+ log_warn "Stale symlink: $(basename "$bin_link") → $target (missing)"
711
+ ((script_warn++)); found_stale_issues=true
712
+ fi
713
+ fi
714
+ done
715
+
716
+ if $found_symlink_issues; then
717
+ fix_commands+=("_fix_script_symlinks")
718
+ fix_descriptions+=("Fix all Karnel tool symlinks")
719
+ fix_callbacks+=("_fix_script_symlinks")
720
+ fi
721
+ if $found_shebang_issues; then
722
+ fix_commands+=("_fix_script_shebangs")
723
+ fix_descriptions+=("Fix all Karnel tool shebangs for Termux")
724
+ fix_callbacks+=("_fix_script_shebangs")
725
+ fi
726
+ if $found_perm_issues; then
727
+ fix_commands+=("_fix_script_perms")
728
+ fix_descriptions+=("Fix all Karnel script permissions")
729
+ fix_callbacks+=("_fix_script_perms")
730
+ fi
731
+ if $found_missing_issues; then
732
+ fix_commands+=("_fix_script_missing")
733
+ fix_descriptions+=("Reinstall missing Karnel tools")
734
+ fix_callbacks+=("_fix_script_missing")
735
+ fi
736
+ if $found_stale_issues; then
737
+ fix_commands+=("_fix_script_stale")
738
+ fix_descriptions+=("Remove stale symlinks from PREFIX/bin")
739
+ fix_callbacks+=("_fix_script_stale")
740
+ fi
741
+
742
+ if (( script_err == 0 && script_warn == 0 )); then
743
+ log_success "All $script_ok Karnel-managed scripts healthy"
744
+ else
745
+ log_info "Scripts: $script_ok OK, $script_warn warnings, $script_err errors"
746
+ fi
747
+
637
748
  echo
638
749
  separator_section "Binary & Shebang Health"
639
750
  echo
@@ -1356,14 +1467,5 @@ EOF
1356
1467
  echo
1357
1468
  }
1358
1469
 
1359
- _fix_keyring() {
1360
- pkg update -y &>/dev/null && pkg install -y termux-keyring &>/dev/null
1361
- }
1362
-
1363
- _fix_apt_cache() {
1364
- rm -rf "$PREFIX/var/apt/lists"/* 2>/dev/null
1365
- pkg update -y &>/dev/null
1366
- }
1367
-
1368
1470
  import "@/cli/commands/doctor/fixes"
1369
1471
  import "@/cli/commands/doctor/code"
@@ -1008,7 +1008,7 @@ EOF
1008
1008
  # Create scripts/run.sh
1009
1009
  cat >scripts/run.sh <<'EOF'
1010
1010
  #!/usr/bin/env bash
1011
- cargo run
1011
+ go run cmd/api/main.go
1012
1012
  EOF
1013
1013
  chmod +x scripts/run.sh
1014
1014
 
@@ -1192,7 +1192,7 @@ EOF
1192
1192
  # Create scripts/run.sh
1193
1193
  cat >scripts/run.sh <<'EOF'
1194
1194
  #!/usr/bin/env bash
1195
- go run cmd/api/main.go
1195
+ cargo run
1196
1196
  EOF
1197
1197
  chmod +x scripts/run.sh
1198
1198