karnel-termux 0.0.1

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 (258) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +454 -0
  3. package/install.sh +272 -0
  4. package/karnel/bin/karnel +77 -0
  5. package/karnel/cli/commands/brain.sh +1553 -0
  6. package/karnel/cli/commands/cleanup.sh +66 -0
  7. package/karnel/cli/commands/doctor.sh +1528 -0
  8. package/karnel/cli/commands/env.sh +233 -0
  9. package/karnel/cli/commands/help.sh +8 -0
  10. package/karnel/cli/commands/ia.sh +502 -0
  11. package/karnel/cli/commands/init.sh +1274 -0
  12. package/karnel/cli/commands/install.sh +718 -0
  13. package/karnel/cli/commands/list.sh +399 -0
  14. package/karnel/cli/commands/open.sh +106 -0
  15. package/karnel/cli/commands/pg.sh +719 -0
  16. package/karnel/cli/commands/reinstall.sh +663 -0
  17. package/karnel/cli/commands/show.sh +90 -0
  18. package/karnel/cli/commands/start.sh +54 -0
  19. package/karnel/cli/commands/status.sh +96 -0
  20. package/karnel/cli/commands/uninstall.sh +668 -0
  21. package/karnel/cli/commands/update.sh +723 -0
  22. package/karnel/cli/commands/upgrade.sh +40 -0
  23. package/karnel/cli/commands/version.sh +3 -0
  24. package/karnel/cli/commands/voice.sh +230 -0
  25. package/karnel/cli/karnel.sh +706 -0
  26. package/karnel/modules/ai.sh +135 -0
  27. package/karnel/modules/auto.sh +114 -0
  28. package/karnel/modules/db.sh +132 -0
  29. package/karnel/modules/deploy.sh +74 -0
  30. package/karnel/modules/dev.sh +148 -0
  31. package/karnel/modules/editor.sh +115 -0
  32. package/karnel/modules/lang.sh +124 -0
  33. package/karnel/modules/npm.sh +146 -0
  34. package/karnel/modules/shell.sh +338 -0
  35. package/karnel/modules/ui.sh +139 -0
  36. package/karnel/modules/voice.sh +118 -0
  37. package/karnel/tools/ai/all.sh +209 -0
  38. package/karnel/tools/ai/antigravity-cli/README.md +45 -0
  39. package/karnel/tools/ai/antigravity-cli/bin/agy +28 -0
  40. package/karnel/tools/ai/antigravity-cli/helper/agy_helper.c +39 -0
  41. package/karnel/tools/ai/antigravity-cli/install.sh +469 -0
  42. package/karnel/tools/ai/claude-code/README.md +45 -0
  43. package/karnel/tools/ai/claude-code/bin/claude +29 -0
  44. package/karnel/tools/ai/claude-code/helper/claude_helper.c +42 -0
  45. package/karnel/tools/ai/claude-code/install.sh +278 -0
  46. package/karnel/tools/ai/cline/install.sh +160 -0
  47. package/karnel/tools/ai/codegraph/README.md +43 -0
  48. package/karnel/tools/ai/codegraph/bin/codegraph +5 -0
  49. package/karnel/tools/ai/codegraph/install.sh +160 -0
  50. package/karnel/tools/ai/codex/README.md +44 -0
  51. package/karnel/tools/ai/codex/install.sh +104 -0
  52. package/karnel/tools/ai/command-code/README.md +62 -0
  53. package/karnel/tools/ai/command-code/install.sh +136 -0
  54. package/karnel/tools/ai/crush/README.md +17 -0
  55. package/karnel/tools/ai/crush/install.sh +89 -0
  56. package/karnel/tools/ai/ctx7/README.md +26 -0
  57. package/karnel/tools/ai/ctx7/install.sh +61 -0
  58. package/karnel/tools/ai/engram/README.md +44 -0
  59. package/karnel/tools/ai/engram/install.sh +127 -0
  60. package/karnel/tools/ai/freebuff/README.md +52 -0
  61. package/karnel/tools/ai/freebuff/bin/freebuff +28 -0
  62. package/karnel/tools/ai/freebuff/helper/freebuff_helper.c +47 -0
  63. package/karnel/tools/ai/freebuff/install.sh +303 -0
  64. package/karnel/tools/ai/gemini-cli/README.md +46 -0
  65. package/karnel/tools/ai/gemini-cli/install.sh +111 -0
  66. package/karnel/tools/ai/gentle-ai/README.md +42 -0
  67. package/karnel/tools/ai/gentle-ai/install.sh +253 -0
  68. package/karnel/tools/ai/gentle-ai/termux-patches.go +256 -0
  69. package/karnel/tools/ai/gga/README.md +49 -0
  70. package/karnel/tools/ai/gga/install.sh +134 -0
  71. package/karnel/tools/ai/hermes-agent/README.md +50 -0
  72. package/karnel/tools/ai/hermes-agent/install.sh +120 -0
  73. package/karnel/tools/ai/kilocode-cli/README.md +45 -0
  74. package/karnel/tools/ai/kilocode-cli/bin/kilocode +21 -0
  75. package/karnel/tools/ai/kilocode-cli/helper/kilocode_helper.c +47 -0
  76. package/karnel/tools/ai/kilocode-cli/install.sh +179 -0
  77. package/karnel/tools/ai/kimchi-code/README.md +53 -0
  78. package/karnel/tools/ai/kimchi-code/install.sh +221 -0
  79. package/karnel/tools/ai/kimi-code/README.md +45 -0
  80. package/karnel/tools/ai/kimi-code/install.sh +111 -0
  81. package/karnel/tools/ai/kiro/README.md +17 -0
  82. package/karnel/tools/ai/kiro/install.sh +134 -0
  83. package/karnel/tools/ai/mimocode/README.md +43 -0
  84. package/karnel/tools/ai/mimocode/bin/mimo +28 -0
  85. package/karnel/tools/ai/mimocode/helper/mimocode_helper.c +47 -0
  86. package/karnel/tools/ai/mimocode/install.sh +287 -0
  87. package/karnel/tools/ai/minimax-cli/README.md +45 -0
  88. package/karnel/tools/ai/minimax-cli/install.sh +111 -0
  89. package/karnel/tools/ai/mistral-vibe/README.md +46 -0
  90. package/karnel/tools/ai/mistral-vibe/install.sh +119 -0
  91. package/karnel/tools/ai/odysseus/README.md +35 -0
  92. package/karnel/tools/ai/odysseus/install.sh +198 -0
  93. package/karnel/tools/ai/ollama/README.md +44 -0
  94. package/karnel/tools/ai/ollama/install.sh +78 -0
  95. package/karnel/tools/ai/omni-route/README.md +111 -0
  96. package/karnel/tools/ai/omni-route/install.sh +165 -0
  97. package/karnel/tools/ai/openclaude/README.md +46 -0
  98. package/karnel/tools/ai/openclaude/install.sh +110 -0
  99. package/karnel/tools/ai/openclaw/README.md +47 -0
  100. package/karnel/tools/ai/openclaw/install.sh +112 -0
  101. package/karnel/tools/ai/opencode/README.md +51 -0
  102. package/karnel/tools/ai/opencode/bin/opencode +28 -0
  103. package/karnel/tools/ai/opencode/helper/opencode_helper.c +57 -0
  104. package/karnel/tools/ai/opencode/install.sh +290 -0
  105. package/karnel/tools/ai/openspec/README.md +34 -0
  106. package/karnel/tools/ai/openspec/install.sh +61 -0
  107. package/karnel/tools/ai/pi/README.md +46 -0
  108. package/karnel/tools/ai/pi/install.sh +104 -0
  109. package/karnel/tools/ai/qwen-code/README.md +45 -0
  110. package/karnel/tools/ai/qwen-code/install.sh +111 -0
  111. package/karnel/tools/auto/all.sh +57 -0
  112. package/karnel/tools/auto/n8n/README.md +47 -0
  113. package/karnel/tools/auto/n8n/install.sh +102 -0
  114. package/karnel/tools/db/all.sh +61 -0
  115. package/karnel/tools/db/mariadb/README.md +43 -0
  116. package/karnel/tools/db/mariadb/install.sh +65 -0
  117. package/karnel/tools/db/mongodb/README.md +42 -0
  118. package/karnel/tools/db/mongodb/install.sh +73 -0
  119. package/karnel/tools/db/postgresql/README.md +45 -0
  120. package/karnel/tools/db/postgresql/install.sh +65 -0
  121. package/karnel/tools/db/redis/README.md +46 -0
  122. package/karnel/tools/db/redis/install.sh +64 -0
  123. package/karnel/tools/db/sqlite/README.md +44 -0
  124. package/karnel/tools/db/sqlite/install.sh +65 -0
  125. package/karnel/tools/deploy/all.sh +43 -0
  126. package/karnel/tools/deploy/netlify/install.sh +41 -0
  127. package/karnel/tools/deploy/railway/install.sh +109 -0
  128. package/karnel/tools/deploy/vercel/install.sh +43 -0
  129. package/karnel/tools/dev/all.sh +77 -0
  130. package/karnel/tools/dev/bat/README.md +44 -0
  131. package/karnel/tools/dev/bat/install.sh +82 -0
  132. package/karnel/tools/dev/bc/README.md +44 -0
  133. package/karnel/tools/dev/bc/install.sh +82 -0
  134. package/karnel/tools/dev/cloudflared/README.md +43 -0
  135. package/karnel/tools/dev/cloudflared/install.sh +82 -0
  136. package/karnel/tools/dev/curl/README.md +43 -0
  137. package/karnel/tools/dev/curl/install.sh +82 -0
  138. package/karnel/tools/dev/fzf/README.md +44 -0
  139. package/karnel/tools/dev/fzf/install.sh +82 -0
  140. package/karnel/tools/dev/gh/README.md +43 -0
  141. package/karnel/tools/dev/gh/install.sh +82 -0
  142. package/karnel/tools/dev/html2text/README.md +44 -0
  143. package/karnel/tools/dev/html2text/install.sh +82 -0
  144. package/karnel/tools/dev/imagemagick/README.md +44 -0
  145. package/karnel/tools/dev/imagemagick/install.sh +82 -0
  146. package/karnel/tools/dev/jq/README.md +44 -0
  147. package/karnel/tools/dev/jq/install.sh +82 -0
  148. package/karnel/tools/dev/lsd/README.md +44 -0
  149. package/karnel/tools/dev/lsd/install.sh +82 -0
  150. package/karnel/tools/dev/make/README.md +44 -0
  151. package/karnel/tools/dev/make/install.sh +82 -0
  152. package/karnel/tools/dev/ncurses/README.md +42 -0
  153. package/karnel/tools/dev/ncurses/install.sh +82 -0
  154. package/karnel/tools/dev/openssh/README.md +43 -0
  155. package/karnel/tools/dev/openssh/install.sh +75 -0
  156. package/karnel/tools/dev/proot/README.md +43 -0
  157. package/karnel/tools/dev/proot/install.sh +82 -0
  158. package/karnel/tools/dev/shfmt/README.md +44 -0
  159. package/karnel/tools/dev/shfmt/install.sh +82 -0
  160. package/karnel/tools/dev/tmate/README.md +44 -0
  161. package/karnel/tools/dev/tmate/install.sh +82 -0
  162. package/karnel/tools/dev/tmux/README.md +43 -0
  163. package/karnel/tools/dev/tmux/install.sh +75 -0
  164. package/karnel/tools/dev/translate/README.md +44 -0
  165. package/karnel/tools/dev/translate/install.sh +82 -0
  166. package/karnel/tools/dev/tree/README.md +44 -0
  167. package/karnel/tools/dev/tree/install.sh +82 -0
  168. package/karnel/tools/dev/udocker/README.md +44 -0
  169. package/karnel/tools/dev/udocker/install.sh +82 -0
  170. package/karnel/tools/dev/wget/README.md +44 -0
  171. package/karnel/tools/dev/wget/install.sh +82 -0
  172. package/karnel/tools/editor/all.sh +59 -0
  173. package/karnel/tools/editor/code-server/README.md +42 -0
  174. package/karnel/tools/editor/code-server/install.sh +74 -0
  175. package/karnel/tools/editor/neovim/README.md +43 -0
  176. package/karnel/tools/editor/neovim/install.sh +64 -0
  177. package/karnel/tools/editor/nvchad/README.md +45 -0
  178. package/karnel/tools/editor/nvchad/install.sh +105 -0
  179. package/karnel/tools/lang/all.sh +63 -0
  180. package/karnel/tools/lang/clang/README.md +43 -0
  181. package/karnel/tools/lang/clang/install.sh +79 -0
  182. package/karnel/tools/lang/golang/README.md +43 -0
  183. package/karnel/tools/lang/golang/install.sh +79 -0
  184. package/karnel/tools/lang/nodejs/README.md +43 -0
  185. package/karnel/tools/lang/nodejs/install.sh +79 -0
  186. package/karnel/tools/lang/perl/README.md +43 -0
  187. package/karnel/tools/lang/perl/install.sh +79 -0
  188. package/karnel/tools/lang/php/README.md +43 -0
  189. package/karnel/tools/lang/php/install.sh +79 -0
  190. package/karnel/tools/lang/python/README.md +43 -0
  191. package/karnel/tools/lang/python/install.sh +79 -0
  192. package/karnel/tools/lang/rust/README.md +43 -0
  193. package/karnel/tools/lang/rust/install.sh +79 -0
  194. package/karnel/tools/npm/all.sh +90 -0
  195. package/karnel/tools/npm/live-server/README.md +43 -0
  196. package/karnel/tools/npm/live-server/install.sh +96 -0
  197. package/karnel/tools/npm/localtunnel/README.md +43 -0
  198. package/karnel/tools/npm/localtunnel/install.sh +112 -0
  199. package/karnel/tools/npm/markserv/README.md +43 -0
  200. package/karnel/tools/npm/markserv/install.sh +95 -0
  201. package/karnel/tools/npm/ncu/README.md +43 -0
  202. package/karnel/tools/npm/ncu/install.sh +95 -0
  203. package/karnel/tools/npm/nestjs/README.md +43 -0
  204. package/karnel/tools/npm/nestjs/install.sh +95 -0
  205. package/karnel/tools/npm/ngrok/README.md +44 -0
  206. package/karnel/tools/npm/ngrok/install.sh +95 -0
  207. package/karnel/tools/npm/prettier/README.md +43 -0
  208. package/karnel/tools/npm/prettier/install.sh +95 -0
  209. package/karnel/tools/npm/psqlformat/README.md +43 -0
  210. package/karnel/tools/npm/psqlformat/install.sh +95 -0
  211. package/karnel/tools/npm/turbopack/README.md +8 -0
  212. package/karnel/tools/npm/turbopack/install.sh +42 -0
  213. package/karnel/tools/npm/typescript/README.md +43 -0
  214. package/karnel/tools/npm/typescript/install.sh +95 -0
  215. package/karnel/tools/npm/vercel/README.md +43 -0
  216. package/karnel/tools/npm/vercel/install.sh +95 -0
  217. package/karnel/tools/shell/all.sh +67 -0
  218. package/karnel/tools/shell/better-npm/README.md +43 -0
  219. package/karnel/tools/shell/better-npm/install.sh +85 -0
  220. package/karnel/tools/shell/fzf-tab/README.md +44 -0
  221. package/karnel/tools/shell/fzf-tab/install.sh +85 -0
  222. package/karnel/tools/shell/history-substring/README.md +43 -0
  223. package/karnel/tools/shell/history-substring/install.sh +85 -0
  224. package/karnel/tools/shell/powerlevel10k/README.md +43 -0
  225. package/karnel/tools/shell/powerlevel10k/install.sh +85 -0
  226. package/karnel/tools/shell/you-should-use/README.md +43 -0
  227. package/karnel/tools/shell/you-should-use/install.sh +85 -0
  228. package/karnel/tools/shell/zsh-autopair/README.md +44 -0
  229. package/karnel/tools/shell/zsh-autopair/install.sh +85 -0
  230. package/karnel/tools/shell/zsh-autosuggestions/README.md +43 -0
  231. package/karnel/tools/shell/zsh-autosuggestions/install.sh +85 -0
  232. package/karnel/tools/shell/zsh-completions/README.md +43 -0
  233. package/karnel/tools/shell/zsh-completions/install.sh +85 -0
  234. package/karnel/tools/shell/zsh-defer/README.md +43 -0
  235. package/karnel/tools/shell/zsh-defer/install.sh +85 -0
  236. package/karnel/tools/shell/zsh-syntax-highlighting/README.md +43 -0
  237. package/karnel/tools/shell/zsh-syntax-highlighting/install.sh +72 -0
  238. package/karnel/tools/ui/all.sh +61 -0
  239. package/karnel/tools/ui/banner/README.md +42 -0
  240. package/karnel/tools/ui/banner/install.sh +160 -0
  241. package/karnel/tools/ui/cursor/README.md +42 -0
  242. package/karnel/tools/ui/cursor/install.sh +58 -0
  243. package/karnel/tools/ui/extra-keys/README.md +43 -0
  244. package/karnel/tools/ui/extra-keys/install.sh +62 -0
  245. package/karnel/tools/ui/font/README.md +43 -0
  246. package/karnel/tools/ui/font/install.sh +63 -0
  247. package/karnel/tools/voice/all.sh +27 -0
  248. package/karnel/tools/voice/install.sh +10 -0
  249. package/karnel/tools/voice/uninstall.sh +8 -0
  250. package/karnel/utils/banner.sh +492 -0
  251. package/karnel/utils/bootstrap.sh +25 -0
  252. package/karnel/utils/colors.sh +33 -0
  253. package/karnel/utils/dialogrc +30 -0
  254. package/karnel/utils/env.sh +53 -0
  255. package/karnel/utils/log.sh +567 -0
  256. package/karnel/utils/version.sh +205 -0
  257. package/package.json +42 -0
  258. package/scripts/npm-install.js +60 -0
package/install.sh ADDED
@@ -0,0 +1,272 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ readonly P_BORDER='\e[38;5;33m'
6
+ readonly P_PRIMARY='\e[38;5;39m'
7
+ readonly P_DIM='\e[38;5;244m'
8
+ readonly P_OK='\e[38;5;42m'
9
+ readonly P_FAIL='\e[1;31m'
10
+ readonly P_HL='\e[38;5;213m'
11
+ readonly P_NC='\e[0m'
12
+
13
+ REPO="https://github.com/israelmarques1024-dotcom/karnel-termux"
14
+ BRANCH="main"
15
+ KARNEL_DATA="${XDG_DATA_HOME:-$HOME/.local/share}/karnel-data"
16
+ KARNEL_REPO="${XDG_DATA_HOME:-$HOME/.local/share}/karnel"
17
+ KARNEL_CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/karnel"
18
+ KARNEL_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/karnel"
19
+
20
+ TOTAL_STEPS=6
21
+ CURRENT_STEP=0
22
+
23
+ _cols() {
24
+ if command -v tput &>/dev/null; then
25
+ tput cols
26
+ else
27
+ echo 80
28
+ fi
29
+ }
30
+
31
+ progress_bar() {
32
+ local current=$1
33
+ local total=$2
34
+ local width=${3:-40}
35
+ local percentage=$((current * 100 / total))
36
+ local filled=$((current * width / total))
37
+ local empty=$((width - filled))
38
+
39
+ printf -v bar "%*s" "$filled" ""
40
+ bar="${bar// /█}"
41
+ printf -v space "%*s" "$empty" ""
42
+ space="${space// /░}"
43
+
44
+ printf "\r ${P_BORDER}│${P_NC}${P_OK}%s${P_NC}${P_DIM}%s${P_NC}${P_BORDER}│${P_NC} ${P_PRIMARY}%3d%%${P_NC}" "${bar}" "${space}" "$percentage"
45
+ }
46
+
47
+ log_step() {
48
+ local step="$1"
49
+ local desc="$2"
50
+ CURRENT_STEP=$((CURRENT_STEP + 1))
51
+ printf "\r%*s\r" "$(_cols)" ""
52
+ echo -e "\n ${P_BORDER}◆${P_NC} ${P_PRIMARY}${CURRENT_STEP}/${TOTAL_STEPS}${P_NC} ${desc}"
53
+ }
54
+
55
+ log_ok() {
56
+ echo -e " ${P_OK}✔${P_NC} $1"
57
+ }
58
+
59
+ log_fail() {
60
+ echo -e " ${P_FAIL}✖${P_NC} $1" >&2
61
+ }
62
+
63
+ log_info() {
64
+ echo -e " ${P_BORDER}→${P_NC} $1"
65
+ }
66
+
67
+ separator() {
68
+ local cols=$(_cols)
69
+ local line=$(printf "%${cols}s")
70
+ echo -e "${P_DIM}${line// /─}${P_NC}"
71
+ }
72
+
73
+ banner() {
74
+ echo
75
+ echo -e " ${P_BORDER}┌────────────────────────────────────┐${P_NC}"
76
+ echo -e " ${P_BORDER}│${P_NC} ${P_PRIMARY} ◈ KARNEL TERMUX ◈${P_NC} ${P_BORDER}│${P_NC}"
77
+ echo -e " ${P_BORDER}│${P_NC} ${P_DIM}Modular Dev Environment for Termux${P_NC} ${P_BORDER}│${P_NC}"
78
+ echo -e " ${P_BORDER}└────────────────────────────────────┘${P_NC}"
79
+ echo
80
+ }
81
+
82
+ bootstrap_dependencies() {
83
+ local needed_tput=0
84
+ local needed_git=0
85
+ local needed_glow=0
86
+ local needed_gh=0
87
+ local needed_rg=0
88
+
89
+ command -v tput &>/dev/null || needed_tput=1
90
+ command -v git &>/dev/null || needed_git=1
91
+ command -v glow &>/dev/null || needed_glow=1
92
+ command -v gh &>/dev/null || needed_gh=1
93
+ command -v rg &>/dev/null || needed_rg=1
94
+
95
+ if [[ $needed_tput -eq 1 || $needed_git -eq 1 || $needed_glow -eq 1 || $needed_gh -eq 1 || $needed_rg -eq 1 ]]; then
96
+ banner
97
+ fi
98
+
99
+ if [[ $needed_tput -eq 1 ]]; then
100
+ echo -e " ${P_BORDER}→${P_NC} Installing ncurses-utils..."
101
+ pkg install -y ncurses-utils &>/dev/null
102
+ echo -e " ${P_OK}✔${P_NC} ncurses-utils installed"
103
+ echo
104
+ fi
105
+
106
+ if [[ $needed_git -eq 1 ]]; then
107
+ log_info "Installing git..."
108
+ progress_bar 0 10
109
+ pkg install -y git &>/dev/null
110
+ progress_bar 10 10
111
+ echo
112
+ log_ok "git installed"
113
+ fi
114
+
115
+ if [[ $needed_glow -eq 1 ]]; then
116
+ log_info "Installing glow..."
117
+ progress_bar 0 10
118
+ pkg install -y glow &>/dev/null
119
+ progress_bar 10 10
120
+ echo
121
+ log_ok "glow installed"
122
+ fi
123
+
124
+ if [[ $needed_gh -eq 1 ]]; then
125
+ log_info "Installing gh (GitHub CLI)..."
126
+ progress_bar 0 10
127
+ pkg install -y gh &>/dev/null
128
+ progress_bar 10 10
129
+ echo
130
+ log_ok "gh installed"
131
+ fi
132
+
133
+ if [[ $needed_rg -eq 1 ]]; then
134
+ log_info "Installing ripgrep..."
135
+ progress_bar 0 10
136
+ pkg install -y ripgrep &>/dev/null
137
+ progress_bar 10 10
138
+ echo
139
+ log_ok "ripgrep installed"
140
+ fi
141
+
142
+ if [[ $needed_tput -eq 1 || $needed_git -eq 1 || $needed_glow -eq 1 || $needed_gh -eq 1 || $needed_rg -eq 1 ]]; then
143
+ echo
144
+ clear
145
+ fi
146
+ }
147
+
148
+ install_dependencies() {
149
+ log_step 1 "Verifying dependencies"
150
+ progress_bar 5 10
151
+ progress_bar 10 10
152
+ echo
153
+ log_ok "Dependencies ready (git, ncurses-utils, glow, gh, ripgrep)"
154
+ }
155
+
156
+ setup_directories() {
157
+ log_step 2 "Setting up directories"
158
+
159
+ mkdir -p "$KARNEL_REPO" "$KARNEL_DATA" "$KARNEL_CACHE" "$KARNEL_CONFIG"
160
+
161
+ log_info "Repo $KARNEL_REPO"
162
+ log_info "Data $KARNEL_DATA"
163
+ log_info "Cache $KARNEL_CACHE"
164
+ log_info "Config $KARNEL_CONFIG"
165
+ log_ok "Directories created"
166
+ }
167
+
168
+ clone_repo() {
169
+ log_step 3 "Cloning repository"
170
+
171
+ local script_dir
172
+ script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
173
+ local is_dev_install=0
174
+
175
+ if [[ -d "$script_dir/.git" ]] && [[ "$script_dir" != "$KARNEL_REPO" ]]; then
176
+ is_dev_install=1
177
+ fi
178
+
179
+ if [[ $is_dev_install -eq 1 ]]; then
180
+ KARNEL_REPO="$script_dir"
181
+ log_info "Developer installation detected"
182
+ log_ok "Using local repository"
183
+ elif [[ -d "$KARNEL_REPO/.git" ]]; then
184
+ progress_bar 3 10
185
+ git -C "$KARNEL_REPO" pull origin "$BRANCH" &>/dev/null
186
+ progress_bar 10 10
187
+ echo
188
+ log_ok "Repository updated"
189
+ else
190
+ progress_bar 0 10
191
+ git clone --depth=1 -b "$BRANCH" "$REPO" "$KARNEL_REPO" &>/dev/null &
192
+ local pid=$!
193
+ local dots=0
194
+ while kill -0 "$pid" 2>/dev/null; do
195
+ dots=$(( (dots + 1) % 4 ))
196
+ printf "\r Cloning%s " "$(printf '%*s' "$dots" '' | tr ' ' '.')"
197
+ sleep 0.5
198
+ done
199
+ wait "$pid"
200
+ progress_bar 10 10
201
+ echo
202
+ log_ok "Repository cloned"
203
+ fi
204
+
205
+ export KARNEL_REPO
206
+ }
207
+
208
+ create_symlink() {
209
+ log_step 4 "Creating symlinks"
210
+
211
+ [[ -z "$PREFIX" ]] && { log_fail "PREFIX is not set. Are you running in Termux?"; return 1; }
212
+
213
+ rm -f "$PREFIX/bin/karnel"
214
+ ln -sf "$KARNEL_REPO/karnel/bin/karnel" "$PREFIX/bin/karnel"
215
+
216
+ if [[ -L "$PREFIX/bin/karnel" ]]; then
217
+ log_ok "Symlink created: karnel → ${KARNEL_REPO}/karnel/bin/karnel"
218
+ else
219
+ log_fail "Failed to create symlink"
220
+ return 1
221
+ fi
222
+ }
223
+
224
+ save_config() {
225
+ log_step 5 "Saving configuration"
226
+
227
+ cat >"$KARNEL_CONFIG/config" <<EOF
228
+ karnel_repo='$KARNEL_REPO'
229
+ karnel_data='$KARNEL_DATA'
230
+ karnel_cache='$KARNEL_CACHE'
231
+ karnel_config='$KARNEL_CONFIG'
232
+ EOF
233
+
234
+ log_ok "Configuration saved"
235
+ }
236
+
237
+ show_final_message() {
238
+ echo
239
+ separator
240
+ echo -e " ${P_OK}◆${P_NC} ${P_PRIMARY}Karnel Installed${P_NC}"
241
+ separator
242
+ echo
243
+ echo -e " ${P_DIM}Author:${P_NC} ${P_HL}israel marques${P_NC}"
244
+ echo
245
+ echo -e " ${P_DIM}Run${P_NC} ${P_HL}karnel${P_NC} ${P_DIM}to get started${P_NC}"
246
+ echo
247
+ echo -e " ${P_DIM}Install modules:${P_NC}"
248
+ echo
249
+ printf " ${P_PRIMARY}%-20s${P_NC} ${P_DIM}%s${P_NC}\n" "karnel install lang" "Programming languages"
250
+ printf " ${P_PRIMARY}%-20s${P_NC} ${P_DIM}%s${P_NC}\n" "karnel install db" "Databases"
251
+ printf " ${P_PRIMARY}%-20s${P_NC} ${P_DIM}%s${P_NC}\n" "karnel install ai" "AI tools"
252
+ printf " ${P_PRIMARY}%-20s${P_NC} ${P_DIM}%s${P_NC}\n" "karnel install editor" "Code editor"
253
+ printf " ${P_PRIMARY}%-20s${P_NC} ${P_DIM}%s${P_NC}\n" "karnel install dev" "Dev tools"
254
+ printf " ${P_PRIMARY}%-20s${P_NC} ${P_DIM}%s${P_NC}\n" "karnel install npm" "Node.js tools"
255
+ printf " ${P_PRIMARY}%-20s${P_NC} ${P_DIM}%s${P_NC}\n" "karnel install shell" "ZSH shell"
256
+ printf " ${P_PRIMARY}%-20s${P_NC} ${P_DIM}%s${P_NC}\n" "karnel install ui" "Termux UI"
257
+ printf " ${P_PRIMARY}%-20s${P_NC} ${P_DIM}%s${P_NC}\n" "karnel install auto" "n8n"
258
+ echo
259
+ }
260
+
261
+ main() {
262
+ bootstrap_dependencies
263
+ banner
264
+ install_dependencies
265
+ setup_directories
266
+ clone_repo
267
+ create_symlink
268
+ save_config
269
+ show_final_message
270
+ }
271
+
272
+ main
@@ -0,0 +1,77 @@
1
+ #!/data/data/com.termux/files/usr/bin/bash
2
+
3
+ SOURCE="${BASH_SOURCE[0]}"
4
+
5
+ # resolver symlink si existe
6
+ while [ -L "$SOURCE" ]; do
7
+ DIR="$(cd -P "$(dirname "$SOURCE")" >/dev/null 2>&1 && pwd)"
8
+ SOURCE="$(readlink "$SOURCE")"
9
+ [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
10
+ done
11
+
12
+ BIN_DIR="$(cd -P "$(dirname "$SOURCE")" >/dev/null 2>&1 && pwd)"
13
+
14
+ # root del proyecto
15
+ KARNEL_PATH="$(cd "$BIN_DIR/.." 2>/dev/null && pwd)" || {
16
+ echo "Error: Could not determine KARNEL_PATH from $BIN_DIR/.." >&2
17
+ exit 1
18
+ }
19
+
20
+ # cargar bootstrap
21
+ source "$KARNEL_PATH/utils/bootstrap.sh"
22
+
23
+ # cargar entorno
24
+ import "@/utils/env"
25
+
26
+ # ===== CHECK UPDATES =====
27
+ check_for_updates() {
28
+ local version_file="$KARNEL_CACHE/last_version_check"
29
+ local current_time=$(date +%s)
30
+ local check_interval=86400 # 24 horas en segundos
31
+ local last_check=0
32
+
33
+ if [[ -f "$version_file" ]]; then
34
+ last_check=$(cat "$version_file" 2>/dev/null | head -1)
35
+ fi
36
+
37
+ if (( current_time - last_check < check_interval )); then
38
+ return 0
39
+ fi
40
+
41
+ mkdir -p "$KARNEL_CACHE"
42
+ echo "$current_time" > "$version_file"
43
+
44
+ (
45
+ local remote_version=$(curl -fsSL "https://raw.githubusercontent.com/israelmarques1024-dotcom/karnel-termux/main/karnel/utils/env.sh" 2>/dev/null | grep "KARNEL_VERSION=" | cut -d'"' -f2)
46
+ local local_version="$KARNEL_VERSION"
47
+ if [[ -n "$remote_version" ]] && [[ "$remote_version" != "$local_version" ]]; then
48
+ echo "$remote_version" > "$KARNEL_CACHE/new_version"
49
+ fi
50
+ ) &>/dev/null &
51
+ }
52
+
53
+ show_update_notification() {
54
+ local new_version_file="$KARNEL_CACHE/new_version"
55
+ if [[ -f "$new_version_file" ]]; then
56
+ local new_version=$(cat "$new_version_file")
57
+ echo
58
+ separator_section "Update Available"
59
+ echo
60
+ log_warn "New version available: ${D_GREEN}$new_version${D_NC} (current: ${D_CYAN}$KARNEL_VERSION${D_NC})"
61
+ echo
62
+ list_item "Run: ${D_CYAN}karnel update${D_NC} to update"
63
+ echo
64
+ fi
65
+ }
66
+
67
+ if [[ "$1" != "update" ]] && [[ "$1" != "uninstall" ]] && [[ "$1" != "reinstall" ]]; then
68
+ check_for_updates
69
+ import "@/utils/log"
70
+ import "@/utils/colors"
71
+ show_update_notification
72
+ fi
73
+
74
+ # cargar CLI unificado (com TUI + help)
75
+ import "@/cli/karnel"
76
+
77
+ karnel_main "$@"