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
@@ -0,0 +1,124 @@
1
+ #!/usr/bin/env bash
2
+
3
+ import "@/utils/log"
4
+ import "@/utils/colors"
5
+
6
+ LOG_FILE="$KARNEL_CACHE/install_lang.log"
7
+
8
+ install_lang() {
9
+ separator
10
+ box "Installing Language Packages"
11
+ separator
12
+ echo
13
+
14
+ log_info "Installing language packages..."
15
+
16
+ mkdir -p "$(dirname "$LOG_FILE")"
17
+
18
+ local rc=0
19
+ _install_lang_wrapper || rc=$?
20
+ if [ "$rc" -eq 0 ]; then
21
+ log_success "Language packages installed successfully"
22
+ else
23
+ log_warn "$rc language package(s) failed to install"
24
+ fi
25
+ separator
26
+ echo
27
+ list_item "Node.js LTS"
28
+ list_item "Python"
29
+ list_item "Perl"
30
+ list_item "PHP"
31
+ list_item "Rust"
32
+ list_item "C/C++ (clang)"
33
+ list_item "Go (golang)"
34
+ echo
35
+ }
36
+
37
+ _install_lang_wrapper() {
38
+ import "@/tools/lang/all"
39
+ install_all_lang_packages
40
+ return $?
41
+ }
42
+
43
+ uninstall_lang() {
44
+ if ! command -v node &>/dev/null; then
45
+ log_info "Language Packages are not installed"
46
+ return 0
47
+ fi
48
+ separator
49
+ box "Uninstalling Language Packages"
50
+ separator
51
+ echo
52
+
53
+ log_info "Uninstalling language packages..."
54
+
55
+ local rc=0
56
+ _uninstall_lang_wrapper || rc=$?
57
+ if [ "$rc" -eq 0 ]; then
58
+ log_success "Language packages uninstalled"
59
+ else
60
+ log_warn "$rc language package(s) failed to uninstall"
61
+ fi
62
+ }
63
+
64
+ _uninstall_lang_wrapper() {
65
+ import "@/tools/lang/all"
66
+ uninstall_all_lang_packages
67
+ return $?
68
+ }
69
+
70
+ update_lang() {
71
+ separator
72
+ box "Updating Language Packages"
73
+ separator
74
+ echo
75
+
76
+ log_info "Updating language packages..."
77
+
78
+ local rc=0
79
+ _update_lang_wrapper || rc=$?
80
+ if [ "$rc" -eq 0 ]; then
81
+ log_success "Language packages updated"
82
+ else
83
+ log_warn "$rc language package(s) failed to update"
84
+ fi
85
+ }
86
+
87
+ _update_lang_wrapper() {
88
+ import "@/tools/lang/all"
89
+ update_all_lang_packages
90
+ return $?
91
+ }
92
+
93
+ reinstall_lang() {
94
+ separator
95
+ box "Reinstalling Language Packages"
96
+ separator
97
+ echo
98
+
99
+ log_info "Reinstalling language packages..."
100
+
101
+ local rc=0
102
+ _reinstall_lang_wrapper || rc=$?
103
+ if [ "$rc" -eq 0 ]; then
104
+ log_success "Language packages reinstalled successfully"
105
+ else
106
+ log_warn "$rc language package(s) failed to reinstall"
107
+ fi
108
+ separator
109
+ echo
110
+ list_item "Node.js LTS"
111
+ list_item "Python"
112
+ list_item "Perl"
113
+ list_item "PHP"
114
+ list_item "Rust"
115
+ list_item "C/C++ (clang)"
116
+ list_item "Go (golang)"
117
+ echo
118
+ }
119
+
120
+ _reinstall_lang_wrapper() {
121
+ import "@/tools/lang/all"
122
+ reinstall_all_lang_packages
123
+ return $?
124
+ }
@@ -0,0 +1,146 @@
1
+ #!/usr/bin/env bash
2
+
3
+ import "@/utils/log"
4
+ import "@/utils/colors"
5
+
6
+ LOG_FILE="$KARNEL_CACHE/install_npm.log"
7
+
8
+ install_npm() {
9
+ separator
10
+ box "Installing Node.js Modules"
11
+ separator
12
+ echo
13
+
14
+ log_info "Installing Node.js global modules..."
15
+
16
+ mkdir -p "$(dirname "$LOG_FILE")"
17
+
18
+ local install_rc=0
19
+ _install_npm_wrapper || install_rc=$?
20
+
21
+ echo
22
+ list_item "TypeScript"
23
+ list_item "NestJS CLI"
24
+ list_item "Prettier"
25
+ list_item "Live Server"
26
+ list_item "Localtunnel"
27
+ list_item "Vercel CLI"
28
+ list_item "Markserv"
29
+ list_item "PSQL Format"
30
+ list_item "NPM Check Updates"
31
+ list_item "Ngrok"
32
+ echo
33
+ separator
34
+ if [ "$install_rc" -eq 0 ]; then
35
+ log_success "Node.js modules installation completed"
36
+ else
37
+ log_warn "$install_rc Node.js module(s) failed to install"
38
+ fi
39
+ separator
40
+ echo
41
+ }
42
+
43
+ _install_npm_wrapper() {
44
+ import "@/tools/npm/all"
45
+ install_all_npm_packages
46
+ return $?
47
+ }
48
+
49
+ uninstall_npm() {
50
+ if ! command -v tsc &>/dev/null; then
51
+ log_info "Node.js Modules are not installed"
52
+ return 0
53
+ fi
54
+ separator
55
+ box "Uninstalling Node.js Modules"
56
+ separator
57
+ echo
58
+
59
+ log_info "Uninstalling Node.js global modules..."
60
+
61
+ local rc=0
62
+ _uninstall_npm_wrapper || rc=$?
63
+
64
+ echo
65
+ separator
66
+ if [ "$rc" -eq 0 ]; then
67
+ log_success "Node.js modules uninstallation completed"
68
+ else
69
+ log_warn "$rc Node.js module(s) failed to uninstall"
70
+ fi
71
+ separator
72
+ echo
73
+ }
74
+
75
+ _uninstall_npm_wrapper() {
76
+ import "@/tools/npm/all"
77
+ uninstall_all_npm_packages
78
+ return $?
79
+ }
80
+
81
+ update_npm() {
82
+ separator
83
+ box "Updating Node.js Modules"
84
+ separator
85
+ echo
86
+
87
+ log_info "Updating Node.js global modules..."
88
+
89
+ local rc=0
90
+ _update_npm_wrapper || rc=$?
91
+
92
+ echo
93
+ separator
94
+ if [ "$rc" -eq 0 ]; then
95
+ log_success "Node.js modules update completed"
96
+ else
97
+ log_warn "$rc Node.js module(s) failed to update"
98
+ fi
99
+ separator
100
+ echo
101
+ }
102
+
103
+ _update_npm_wrapper() {
104
+ import "@/tools/npm/all"
105
+ update_all_npm_packages
106
+ return $?
107
+ }
108
+
109
+ reinstall_npm() {
110
+ separator
111
+ box "Reinstalling Node.js Modules"
112
+ separator
113
+ echo
114
+
115
+ log_info "Reinstalling Node.js global modules..."
116
+
117
+ local rc=0
118
+ _reinstall_npm_wrapper || rc=$?
119
+
120
+ echo
121
+ list_item "TypeScript"
122
+ list_item "NestJS CLI"
123
+ list_item "Prettier"
124
+ list_item "Live Server"
125
+ list_item "Localtunnel"
126
+ list_item "Vercel CLI"
127
+ list_item "Markserv"
128
+ list_item "PSQL Format"
129
+ list_item "NPM Check Updates"
130
+ list_item "Ngrok"
131
+ echo
132
+ separator
133
+ if [ "$rc" -eq 0 ]; then
134
+ log_success "Node.js modules reinstallation completed"
135
+ else
136
+ log_warn "$rc Node.js module(s) failed to reinstall"
137
+ fi
138
+ separator
139
+ echo
140
+ }
141
+
142
+ _reinstall_npm_wrapper() {
143
+ import "@/tools/npm/all"
144
+ reinstall_all_npm_packages
145
+ return $?
146
+ }
@@ -0,0 +1,338 @@
1
+ #!/usr/bin/env bash
2
+
3
+ import "@/utils/log"
4
+ import "@/utils/colors"
5
+
6
+ ZSH_PLUGINS_DIR="$HOME/.zsh-plugins"
7
+ OH_MY_ZSH_DIR="$HOME/.oh-my-zsh"
8
+ LOG_FILE="$KARNEL_CACHE/install_shell.log"
9
+
10
+ install_termux_packages() {
11
+ log_info "Installing dependencies..."
12
+
13
+ if pkg install -y zsh lsd bat fzf zoxide &>>"$LOG_FILE"; then
14
+ log_success "Dependencies installed successfully"
15
+ return 0
16
+ else
17
+ log_error "Failed to install dependencies"
18
+ return 1
19
+ fi
20
+ }
21
+
22
+ install_oh_my_zsh() {
23
+ if [[ -d "$OH_MY_ZSH_DIR" ]]; then
24
+ log_warn "Oh My Zsh already installed"
25
+ return 0
26
+ fi
27
+
28
+ log_info "Downloading Oh My Zsh..."
29
+ log_info "When prompted, enter (Y/n) to set ZSH as your default shell"
30
+ echo
31
+
32
+ local temp_dir="${PREFIX:-/tmp}/tmp"
33
+ mkdir -p "$temp_dir"
34
+ local temp_file="$temp_dir/omz_install.sh"
35
+
36
+ if curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -o "$temp_file" &>>"$LOG_FILE"; then
37
+ sed -i '/exec zsh -l/s/^/#/' "$temp_file"
38
+ sh "$temp_file" &>>"$LOG_FILE"
39
+ rm "$temp_file"
40
+ log_success "Oh My Zsh installed successfully"
41
+ return 0
42
+ else
43
+ log_error "Failed to download Oh My Zsh"
44
+ return 1
45
+ fi
46
+ }
47
+
48
+ add_to_zshrc() {
49
+ local line="$1"
50
+ if ! grep -qxF "$line" ~/.zshrc 2>/dev/null; then
51
+ echo "$line" >>~/.zshrc
52
+ fi
53
+ }
54
+
55
+ setup_zsh_aliases() {
56
+ log_info "Setting up ZSH aliases..."
57
+
58
+ add_to_zshrc "alias ls=\"lsd\""
59
+ add_to_zshrc 'alias cat="bat --theme=Dracula --style=plain --paging=never"'
60
+ add_to_zshrc 'eval "$(zoxide init zsh)"'
61
+
62
+ log_success "ZSH aliases configured"
63
+ }
64
+
65
+ setup_shell_env() {
66
+ log_info "Setting up shell environment..."
67
+
68
+ add_to_zshrc "unalias gga 2>/dev/null"
69
+ add_to_zshrc "export GOPATH=\"\$HOME/.local/go\""
70
+ add_to_zshrc "export GOCACHE=\"\$HOME/.cache/go\""
71
+ add_to_zshrc "export GOMODCACHE=\"\$GOPATH/pkg/mod\""
72
+ add_to_zshrc "export PATH=\$PATH:\$HOME/go/bin"
73
+ add_to_zshrc "export OPENCLAW_DISABLE_BONJOUR=1"
74
+
75
+ log_success "Shell environment configured"
76
+ }
77
+
78
+ setupPersistentSession() {
79
+ log_info "Configuring persistent session..."
80
+
81
+ mkdir -p "$KARNEL_CACHE" 2>/dev/null || mkdir -p ~/.cache/karnel
82
+
83
+ echo "$HOME" > ~/.cache/karnel/last_dir
84
+
85
+ if grep -q "# ===== Persistent Directory =====" ~/.zshrc 2>/dev/null; then
86
+ log_warn "Persistent session already configured"
87
+ return 0
88
+ fi
89
+
90
+ cat >>~/.zshrc <<'EOF'
91
+
92
+ # ===== Persistent Directory =====
93
+ LAST_DIR_FILE="$HOME/.cache/karnel/last_dir"
94
+ SESSION_TIMESTAMP="$HOME/.cache/karnel/.session_time"
95
+ SESSION_TIMEOUT=5
96
+
97
+ save_dir() {
98
+ mkdir -p ~/.cache/karnel 2>/dev/null
99
+ pwd > "$LAST_DIR_FILE"
100
+ date +%s > "$SESSION_TIMESTAMP"
101
+ }
102
+
103
+ restore_dir() {
104
+ if [[ -f "$SESSION_TIMESTAMP" ]] && [[ -f "$LAST_DIR_FILE" ]]; then
105
+ local current_time
106
+ local last_time
107
+ current_time=$(date +%s)
108
+ last_time=$(cat "$SESSION_TIMESTAMP" 2>/dev/null || echo 0)
109
+ local diff=$((current_time - last_time))
110
+
111
+ if [[ $diff -lt $SESSION_TIMEOUT ]]; then
112
+ local dir
113
+ dir=$(cat "$LAST_DIR_FILE" 2>/dev/null)
114
+ if [[ -d "$dir" ]] && [[ "$dir" != "$HOME" ]]; then
115
+ cd "$dir" 2>/dev/null
116
+ fi
117
+ fi
118
+ fi
119
+ date +%s > "$SESSION_TIMESTAMP"
120
+ }
121
+
122
+ if typeset -f add-zsh-hook &>/dev/null; then
123
+ add-zsh-hook precmd save_dir
124
+ restore_dir
125
+ else
126
+ restore_dir
127
+ trap 'save_dir' EXIT
128
+ fi
129
+ echo
130
+ EOF
131
+
132
+ log_success "Persistent session configured"
133
+ log_info "New sessions within Termux will restore last directory"
134
+ }
135
+
136
+ install_shell() {
137
+ separator
138
+ box "Installing ZSH Shell Environment"
139
+ separator
140
+ echo
141
+
142
+ mkdir -p "$(dirname "$LOG_FILE")"
143
+
144
+ loading "Installing base packages" install_termux_packages
145
+ log_success "Base packages installed"
146
+ echo
147
+
148
+ install_oh_my_zsh
149
+ echo
150
+
151
+ local rc=0
152
+ _install_shell_plugins_wrapper || rc=$?
153
+ log_success "ZSH plugins installed"
154
+ echo
155
+
156
+ setup_zsh_aliases
157
+ echo
158
+
159
+ setup_shell_env
160
+ echo
161
+
162
+ setupPersistentSession
163
+ echo
164
+
165
+ separator
166
+ if [ "$rc" -eq 0 ]; then
167
+ log_success "ZSH shell environment setup completed"
168
+ else
169
+ log_warn "$rc ZSH plugin(s) failed to install"
170
+ fi
171
+ separator
172
+ echo
173
+ log_warn "Please restart Termux or run: exec zsh"
174
+ echo
175
+ }
176
+
177
+ _install_shell_plugins_wrapper() {
178
+ import "@/tools/shell/all"
179
+ install_all_shell_plugins
180
+ local plugin_rc=$?
181
+
182
+ if [[ -d "$ZSH_PLUGINS_DIR/powerlevel10k" ]]; then
183
+ add_to_zshrc 'source ~/.zsh-plugins/powerlevel10k/powerlevel10k.zsh-theme'
184
+ fi
185
+ if [[ -d "$ZSH_PLUGINS_DIR/zsh-defer" ]]; then
186
+ add_to_zshrc 'source ~/.zsh-plugins/zsh-defer/zsh-defer.plugin.zsh'
187
+ fi
188
+ if [[ -d "$ZSH_PLUGINS_DIR/zsh-autosuggestions" ]]; then
189
+ add_to_zshrc 'source ~/.zsh-plugins/zsh-autosuggestions/zsh-autosuggestions.zsh'
190
+ fi
191
+ if [[ -d "$ZSH_PLUGINS_DIR/zsh-syntax-highlighting" ]]; then
192
+ add_to_zshrc 'source ~/.zsh-plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh'
193
+ fi
194
+ if [[ -d "$ZSH_PLUGINS_DIR/zsh-history-substring-search" ]]; then
195
+ add_to_zshrc 'source ~/.zsh-plugins/zsh-history-substring-search/zsh-history-substring-search.zsh'
196
+ add_to_zshrc "bindkey '^[[A' history-substring-search-up"
197
+ add_to_zshrc "bindkey '^[[B' history-substring-search-down"
198
+ fi
199
+ if [[ -d "$ZSH_PLUGINS_DIR/zsh-completions" ]]; then
200
+ add_to_zshrc 'fpath+=~/.zsh-plugins/zsh-completions'
201
+ fi
202
+ if [[ -d "$ZSH_PLUGINS_DIR/fzf-tab" ]]; then
203
+ add_to_zshrc 'source ~/.zsh-plugins/fzf-tab/fzf-tab.plugin.zsh'
204
+ add_to_zshrc "zstyle ':completion:*' menu-select yes"
205
+ add_to_zshrc "zstyle ':fzf-tab:*' switch-word yes"
206
+ fi
207
+ if [[ -d "$ZSH_PLUGINS_DIR/zsh-you-should-use" ]]; then
208
+ add_to_zshrc 'source ~/.zsh-plugins/zsh-you-should-use/you-should-use.plugin.zsh'
209
+ fi
210
+ if [[ -d "$ZSH_PLUGINS_DIR/zsh-autopair" ]]; then
211
+ add_to_zshrc 'source ~/.zsh-plugins/zsh-autopair/autopair.zsh'
212
+ fi
213
+ if [[ -d "$ZSH_PLUGINS_DIR/zsh-better-npm-completion" ]]; then
214
+ add_to_zshrc 'source ~/.zsh-plugins/zsh-better-npm-completion/zsh-better-npm-completion.plugin.zsh'
215
+ fi
216
+
217
+ return $plugin_rc
218
+ }
219
+
220
+ uninstall_oh_my_zsh() {
221
+ if [[ ! -d "$OH_MY_ZSH_DIR" ]]; then
222
+ log_warn "Oh My Zsh not installed"
223
+ return 0
224
+ fi
225
+
226
+ log_info "Uninstalling Oh My Zsh..."
227
+
228
+ if rm -rf "$OH_MY_ZSH_DIR" &>>"$LOG_FILE"; then
229
+ log_success "Oh My Zsh uninstalled"
230
+ else
231
+ log_error "Failed to uninstall Oh My Zsh"
232
+ return 1
233
+ fi
234
+ }
235
+
236
+ uninstall_shell() {
237
+ if [[ ! -d "$OH_MY_ZSH_DIR" ]]; then
238
+ log_info "ZSH Shell Environment is not installed"
239
+ return 0
240
+ fi
241
+ separator
242
+ box "Uninstalling ZSH Shell Environment"
243
+ separator
244
+ echo
245
+
246
+ mkdir -p "$(dirname "$LOG_FILE")"
247
+
248
+ local rc=0
249
+ _uninstall_shell_plugins_wrapper || rc=$?
250
+ loading "Removing Oh My Zsh" uninstall_oh_my_zsh
251
+
252
+ echo
253
+ separator
254
+ if [ "$rc" -eq 0 ]; then
255
+ log_success "ZSH shell environment uninstalled"
256
+ else
257
+ log_warn "$rc ZSH plugin(s) failed to uninstall"
258
+ fi
259
+ separator
260
+ echo
261
+ }
262
+
263
+ _uninstall_shell_plugins_wrapper() {
264
+ import "@/tools/shell/all"
265
+ uninstall_all_shell_plugins
266
+ return $?
267
+ }
268
+
269
+ update_shell() {
270
+ separator
271
+ box "Updating ZSH Shell Environment"
272
+ separator
273
+ echo
274
+
275
+ mkdir -p "$(dirname "$LOG_FILE")"
276
+
277
+ local rc=0
278
+ _update_shell_plugins_wrapper || rc=$?
279
+ if [ "$rc" -eq 0 ]; then
280
+ log_success "ZSH shell environment updated"
281
+ else
282
+ log_warn "$rc ZSH plugin(s) failed to update"
283
+ fi
284
+
285
+ setup_shell_env
286
+ echo
287
+
288
+ separator
289
+ log_success "ZSH update completed"
290
+ separator
291
+ echo
292
+ }
293
+
294
+ _update_shell_plugins_wrapper() {
295
+ import "@/tools/shell/all"
296
+ update_all_shell_plugins
297
+ return $?
298
+ }
299
+
300
+ reinstall_shell() {
301
+ separator
302
+ box "Reinstalling ZSH Shell Environment"
303
+ separator
304
+ echo
305
+
306
+ mkdir -p "$(dirname "$LOG_FILE")"
307
+
308
+ local rc=0
309
+ _reinstall_shell_plugins_wrapper || rc=$?
310
+ log_success "ZSH plugins reinstalled"
311
+ echo
312
+
313
+ setup_zsh_aliases
314
+ echo
315
+
316
+ setup_shell_env
317
+ echo
318
+
319
+ setupPersistentSession
320
+ echo
321
+
322
+ separator
323
+ if [ "$rc" -eq 0 ]; then
324
+ log_success "ZSH shell environment reinstallation completed"
325
+ else
326
+ log_warn "$rc ZSH plugin(s) failed to reinstall"
327
+ fi
328
+ separator
329
+ echo
330
+ log_warn "Please restart Termux or run: exec zsh"
331
+ echo
332
+ }
333
+
334
+ _reinstall_shell_plugins_wrapper() {
335
+ import "@/tools/shell/all"
336
+ reinstall_all_shell_plugins
337
+ return $?
338
+ }