karnel-termux 4.17.5 → 4.17.6

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 (32) hide show
  1. package/README.md +2 -2
  2. package/docs/{ARCHITECTURE.md → ARCHITECTURE/index.md} +14 -8
  3. package/docs/_config.yml +8 -0
  4. package/docs/index.md +39 -0
  5. package/karnel/RELEASE_COMMIT +1 -1
  6. package/karnel/cli/commands/pg.sh +13 -7
  7. package/karnel/modules/shell.sh +18 -7
  8. package/karnel/tools/db/mongodb/install.sh +3 -0
  9. package/karnel/tools/deploy/netlify/install.sh +42 -19
  10. package/karnel/tools/deploy/supabase/install.sh +6 -1
  11. package/karnel/tools/deploy/vercel/install.sh +30 -11
  12. package/karnel/tools/editor/code-server/install.sh +20 -8
  13. package/karnel/tools/lang/rust/install.sh +1 -1
  14. package/karnel/tools/npm/live-server/install.sh +4 -3
  15. package/karnel/tools/npm/localtunnel/install.sh +4 -3
  16. package/karnel/tools/npm/markserv/install.sh +4 -3
  17. package/karnel/tools/npm/ncu/install.sh +4 -3
  18. package/karnel/tools/npm/nestjs/install.sh +4 -3
  19. package/karnel/tools/npm/ngrok/install.sh +4 -3
  20. package/karnel/tools/npm/prettier/install.sh +4 -3
  21. package/karnel/tools/npm/psqlformat/install.sh +4 -3
  22. package/karnel/tools/npm/typescript/install.sh +4 -3
  23. package/karnel/tools/npm/vercel/install.sh +4 -3
  24. package/karnel/tools/voice/uninstall.sh +10 -1
  25. package/karnel/utils/log.sh +2 -2
  26. package/karnel/utils/uninstall.sh +16 -2
  27. package/karnel/utils/version.sh +25 -25
  28. package/package.json +1 -1
  29. package/docs/README.md +0 -35
  30. /package/docs/cli/{README.md → index.md} +0 -0
  31. /package/docs/doctor/{README.md → index.md} +0 -0
  32. /package/docs/{troubleshooting.md → troubleshooting/index.md} +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.16.1-0078D4?style=for-the-badge" alt="Version">
11
+ <img src="https://img.shields.io/badge/version-4.17.6-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">
@@ -64,7 +64,7 @@ Core agent contributions by **devcorex**.
64
64
  ### Via checksummed GitHub release (recommended)
65
65
 
66
66
  ```bash
67
- version=4.16.1
67
+ version=4.17.6
68
68
  tmpdir=$(mktemp -d) && trap 'rm -rf "$tmpdir"' EXIT
69
69
  base="https://github.com/israelmarques1024-dotcom/karnel-termux/releases/download/v$version"
70
70
  curl -fsSL "$base/karnel-termux-install.sh" -o "$tmpdir/karnel-termux-install.sh"
@@ -31,14 +31,18 @@ karnel-termux/
31
31
  │ │ ├── lang/ # 8 languages
32
32
  │ │ ├── db/ # 5 databases
33
33
  │ │ ├── dev/ # 22 dev tools
34
- │ │ ├── editor/ # Code editor
35
- │ │ ├── npm/ # Global npm packages
36
- │ │ ├── shell/ # ZSH plugins
37
- │ │ ├── ui/ # Termux UI
38
- │ │ ├── auto/ # Automation
39
- │ │ ├── deploy/ # Deploy CLIs
34
+ │ │ ├── editor/ # code-server, Neovim, NvChad
35
+ │ │ ├── npm/ # 11 global npm packages
36
+ │ │ ├── shell/ # ZSH + 10 plugins
37
+ │ │ ├── ui/ # 4 UI components
38
+ │ │ ├── auto/ # n8n automation
39
+ │ │ ├── deploy/ # 4 deploy CLIs
40
+ │ │ ├── games/ # 6 games
40
41
  │ │ ├── network/ # 2 network tools (dark, dedsec-network)
41
42
  │ │ ├── utils/ # 12 utility tools (fconv, notes, zork, SuperFile, etc.)
43
+ │ │ ├── security/ # 30 security tools
44
+ │ │ ├── voice/ # Speech-to-agent via Termux:API
45
+ │ │ ├── plugins/ # Built-in plugin manager
42
46
  │ │ └── osint/ # Robin OSINT integration
43
47
  │ └── utils/ # Shared utilities
44
48
  │ ├── bootstrap.sh # Import mechanism, shell detection
@@ -105,7 +109,9 @@ on the caller's dynamic scope.
105
109
 
106
110
  ## Module System
107
111
 
108
- Each module (`lang`, `db`, `ai`, `dev`, etc.) has:
112
+ Each module (`ai`, `auto`, `db`, `deploy`, `dev`, `editor`, `games`, `lang`,
113
+ `network`, `npm`, `osint`, `security`, `shell`, `ui`, `utils`, `voice`,
114
+ `plugin`) has:
109
115
 
110
116
  1. A **module orchestrator** in `karnel/modules/<name>.sh` — handles installation logic
111
117
  2. Individual **tool installers** in `karnel/tools/<name>/<tool>/install.sh` — each installs one tool
@@ -133,4 +139,4 @@ _tool_postinstall() { ... } # Post-installation setup
133
139
 
134
140
  ## Doctor Subsystem Architecture
135
141
 
136
- See [Doctor System](./doctor/README.md) for the complete breakdown of the doctor code analysis engine.
142
+ See [Doctor System](./doctor/) for the complete breakdown of the doctor code analysis engine.
@@ -0,0 +1,8 @@
1
+ title: Karnel Termux
2
+ description: Modular Dev Environment for Termux — install languages, databases, AI agents, editors, and more with one command.
3
+ theme: jekyll-theme-cayman
4
+ markdown: kramdown
5
+ exclude:
6
+ - vendor
7
+ - Gemfile
8
+ - Gemfile.lock
package/docs/index.md ADDED
@@ -0,0 +1,39 @@
1
+ # Karnel Termux Documentation
2
+
3
+ > Modular Dev Environment for Termux — install languages, databases, AI agents, editors, and more with one command
4
+
5
+ ## Quick Links
6
+
7
+ - [CLI Commands](./cli/) — All `karnel` subcommands
8
+ - [Doctor System](./doctor/) — Environment diagnosis and code analysis
9
+ - [Troubleshooting](./troubleshooting/) — Common issues and fixes
10
+ - [Architecture Overview](./ARCHITECTURE/)
11
+ - [Bug Fixes & Changelog](./CHANGELOG.md)
12
+ - [Published Documentation Site](https://israelmarques1024-dotcom.github.io/karnel-termux/)
13
+
14
+ ## What is Karnel?
15
+
16
+ Karnel Termux transforms your Android device into a complete development workstation.
17
+ With a single CLI (`karnel`), you can install and manage 43 AI tools, 8 languages,
18
+ 5 databases, 22 dev tools, 11 npm packages, 10 shell plugins, 4 UI components,
19
+ 4 deploy CLIs, 6 games, 2 network tools, 12 utility tools, 30 security tools,
20
+ responsible OSINT, a second brain, voice commands, and reviewed plugins — all
21
+ from modules: `ai`, `auto`, `db`, `deploy`, `dev`, `editor`, `games`, `lang`,
22
+ `network`, `npm`, `osint`, `security`, `shell`, `ui`, `utils`, `voice`, `plugin`.
23
+
24
+ ## Sections
25
+
26
+ - **[CLI Commands](./cli/)** — Full reference for every `karnel` subcommand
27
+ - **[Doctor System](./doctor/)** — How `karnel doctor` works, code analysis engine, environment checks
28
+ - **[Robin OSINT](https://github.com/israelmarques1024-dotcom/karnel-termux/blob/main/karnel/tools/osint/robin/README.md)** — Responsible use, lifecycle, data locations, and troubleshooting
29
+ - **[Network Tools](https://github.com/israelmarques1024-dotcom/karnel-termux/blob/main/karnel/tools/network/dark/README.md)** — dark, dedsec-network
30
+ - **[KeelCode](https://github.com/israelmarques1024-dotcom/karnel-termux/blob/main/karnel/tools/ai/keelcode/README.md)** — Hosted coding-agent CLI: `karnel install ai --keelcode`
31
+ - **[SuperFile](https://github.com/israelmarques1024-dotcom/karnel-termux/blob/main/karnel/tools/utils/superfile/README.md)** — Terminal file manager: `karnel install utils --superfile`
32
+ - **[Utility Scripts](https://github.com/israelmarques1024-dotcom/karnel-termux/blob/main/karnel/tools/utils/fconv/README.md)** — fconv, notes, treex, SuperFile, passman, applaunch, splash, httptmux, zork, qrcode and more
33
+ - **[Supabase CLI](./cli/#supabase--remote-project-helpers)** — `karnel supabase` remote-project helpers
34
+ - **[Architecture](./ARCHITECTURE/)** — Project structure, module system, import mechanism
35
+ - **[Changelog](./CHANGELOG.md)** — Version history, bug fixes, known issues
36
+
37
+ ## Credits
38
+
39
+ Created by **Israel Marques**. Core agent contributions by **devcorex**.
@@ -1 +1 @@
1
- 2e76f74b21de6f9a01911b2c06b96ac09d12359d
1
+ 0b701b2757116687f7022e331187baa382cf63a9
@@ -4,9 +4,19 @@ import "@/utils/log"
4
4
  import "@/utils/colors"
5
5
 
6
6
  # Variáveis globais do PostgreSQL
7
+ : "${PREFIX:=/data/data/com.termux/files/usr}"
7
8
  PG_DATA_DEFAULT="$PREFIX/var/lib/postgresql"
8
9
  PG_LOG="$KARNEL_CACHE/postgresql.log"
9
- PG_USER="postgres"
10
+ # Termux PostgreSQL creates the superuser role from the OS user, not "postgres".
11
+ PG_USER="$(id -un 2>/dev/null || whoami 2>/dev/null || echo postgres)"
12
+ PGPORT="5432"
13
+ # Prefer the local Unix socket; fall back to TCP only when the socket is absent.
14
+ if [[ -d "$PREFIX/var/run/postgresql" ]]; then
15
+ PGHOST="$PREFIX/var/run/postgresql"
16
+ else
17
+ PGHOST="localhost"
18
+ fi
19
+ export PGUSER="$PG_USER" PGPORT="$PGPORT" PGHOST="$PGHOST" PGDATABASE="postgres"
10
20
 
11
21
  # Função para exportar variáveis de ambiente do PostgreSQL
12
22
  pg_export_env() {
@@ -15,7 +25,7 @@ pg_export_env() {
15
25
  export PGDATA="$data_dir"
16
26
  export PGUSER="$PG_USER"
17
27
  export PGPORT="5432"
18
- export PGHOST="localhost"
28
+ export PGHOST="$PGHOST"
19
29
  export PGDATABASE="postgres"
20
30
  # Adicionar binários do PostgreSQL ao PATH se necessário
21
31
  if [[ -d "$PREFIX/bin" ]]; then
@@ -116,11 +126,7 @@ pg_init() {
116
126
  log_success "PostgreSQL initialized successfully"
117
127
  echo
118
128
  list_item "Data directory: $PG_DATA_DEFAULT"
119
- list_item "OS user: $os_user (superuser)"
120
- list_item "PostgreSQL user: $PG_USER (may need to be created)"
121
- echo
122
- log_info "To create the 'postgres' role:"
123
- list_item "${D_CYAN}psql -d postgres -c \"CREATE ROLE $PG_USER LOGIN SUPERUSER;\"${NC}"
129
+ list_item "Superuser role: $PG_USER (the Termux OS user)"
124
130
  echo
125
131
  log_info "Start PostgreSQL with: ${D_CYAN}karnel pg start${NC}"
126
132
  else
@@ -51,10 +51,12 @@ install_oh_my_zsh() (
51
51
  log_error "Unable to pin the Oh My Zsh clone"
52
52
  return 1
53
53
  fi
54
- if ! CHSH=no RUNZSH=no BRANCH="$OH_MY_ZSH_REF" sh "$temp_file" &>>"$LOG_FILE"; then
54
+ if ! CHSH=no RUNZSH=no BRANCH="master" sh "$temp_file" &>>"$LOG_FILE"; then
55
55
  log_error "Failed to install Oh My Zsh"
56
56
  return 1
57
57
  fi
58
+ # Record Karnel ownership so uninstall only removes a Karnel-managed install.
59
+ : >"$OH_MY_ZSH_DIR/.karnel-managed"
58
60
  log_success "Oh My Zsh installed successfully"
59
61
  return 0
60
62
  else
@@ -159,16 +161,25 @@ install_shell() {
159
161
 
160
162
  mkdir -p "$(dirname "$LOG_FILE")"
161
163
 
162
- loading "Installing base packages" install_termux_packages
163
- log_success "Base packages installed"
164
+ local rc=0
165
+ if ! loading "Installing base packages" install_termux_packages; then
166
+ log_error "Base package installation failed"
167
+ rc=1
168
+ fi
164
169
  echo
165
170
 
166
- install_oh_my_zsh
171
+ if ! install_oh_my_zsh; then
172
+ log_error "Oh My Zsh installation failed"
173
+ rc=1
174
+ fi
167
175
  echo
168
176
 
169
- local rc=0
170
177
  _install_shell_plugins_wrapper || rc=$?
171
- log_success "ZSH plugins installed"
178
+ if (( rc == 0 )); then
179
+ log_success "ZSH plugins installed"
180
+ else
181
+ log_warn "ZSH plugin(s) failed to install"
182
+ fi
172
183
  echo
173
184
 
174
185
  setup_zsh_aliases
@@ -245,7 +256,7 @@ uninstall_oh_my_zsh() {
245
256
  log_info "Uninstalling Oh My Zsh..."
246
257
 
247
258
  local remove_rc=0
248
- confirm_remove_paths "Oh My Zsh" "$OH_MY_ZSH_DIR" &>>"$LOG_FILE" || remove_rc=$?
259
+ confirm_remove_paths "Oh My Zsh" "$OH_MY_ZSH_DIR" || remove_rc=$?
249
260
  if [[ "$remove_rc" -eq 0 ]]; then
250
261
  log_success "Oh My Zsh uninstalled"
251
262
  elif [[ "$remove_rc" -eq 2 ]]; then
@@ -13,6 +13,9 @@ _install_mongodb_impl() {
13
13
  log_error "Failed to install tur-repo"
14
14
  return 1
15
15
  fi
16
+ if ! pkg update -y &>>"$LOG_FILE"; then
17
+ log_warn "pkg update after adding tur-repo failed (see $LOG_FILE)"
18
+ fi
16
19
  fi
17
20
 
18
21
  if pkg install mongodb -y &>>"$LOG_FILE"; then
@@ -3,12 +3,22 @@
3
3
  import "@/utils/log"
4
4
  import "@/utils/version"
5
5
 
6
+ LOG_FILE="${LOG_FILE:-${KARNEL_CACHE:-$HOME/.cache/karnel}/install_deploy.log}"
7
+
6
8
  NETLIFY_VERSION="27.1.1"
9
+ NETLIFY_MARKER="$PREFIX/share/karnel-installers/netlify"
10
+
11
+ _netlify_is_owned() {
12
+ command -v netlify &>/dev/null && [[ -f "$NETLIFY_MARKER" ]] || return 1
13
+ }
7
14
 
8
15
  _netlify_node_supported() {
9
- local version
16
+ local version required
10
17
  version="$(node --version 2>/dev/null | sed 's/^v//')"
11
- [[ -n "$version" ]] && [[ "$(printf '%s\n%s\n' '22.13.0' "$version" | sort -V | head -1)" == "22.13.0" ]]
18
+ [[ -n "$version" ]] || return 1
19
+ required="$(npm view "netlify-cli@$NETLIFY_VERSION" engines.node 2>/dev/null | tr -d "'" | sed 's/[<>=~^ ]//g')"
20
+ required="${required:-18.0.0}"
21
+ [[ "$(printf '%s\n%s\n' "$required" "$version" | sort -V | head -1)" == "$required" ]]
12
22
  }
13
23
 
14
24
  install_netlify() {
@@ -16,6 +26,7 @@ install_netlify() {
16
26
  log_info "Netlify CLI is already installed"
17
27
  return 2
18
28
  fi
29
+ mkdir -p "$(dirname "$LOG_FILE")"
19
30
  if ! command -v node &>/dev/null || ! command -v npm &>/dev/null; then
20
31
  log_info "Installing Node.js..."
21
32
  if ! pkg install -y nodejs-lts &>>"$LOG_FILE"; then
@@ -23,29 +34,35 @@ install_netlify() {
23
34
  return 1
24
35
  fi
25
36
  fi
26
- if ! _netlify_node_supported; then
27
- log_error "Netlify CLI requires Node.js 22.13.0 or newer. Update Node.js and retry."
28
- return 1
29
- fi
37
+ if ! _netlify_node_supported; then
38
+ log_error "Netlify CLI requires Node.js (see: npm view netlify-cli@$NETLIFY_VERSION engines.node); update Node.js and retry."
39
+ return 1
40
+ fi
30
41
  log_info "Installing Netlify CLI..."
31
- npm install -g "netlify-cli@$NETLIFY_VERSION" &>/dev/null || {
32
- log_error "Failed to install Netlify CLI"
42
+ if ! npm install -g "netlify-cli@$NETLIFY_VERSION" --legacy-peer-deps &>>"$LOG_FILE"; then
43
+ log_error "Failed to install Netlify CLI (see $LOG_FILE)"
33
44
  return 1
34
- }
45
+ fi
35
46
  command -v termux-fix-shebang &>/dev/null && termux-fix-shebang "$(command -v netlify)" &>/dev/null
36
- if ! netlify --version &>/dev/null; then
37
- log_error "Netlify CLI did not start after installation"
38
- return 1
39
- fi
47
+ if ! netlify --version &>/dev/null; then
48
+ log_error "Netlify CLI did not start after installation"
49
+ return 1
50
+ fi
51
+ mkdir -p "$(dirname "$NETLIFY_MARKER")" && : >"$NETLIFY_MARKER"
40
52
  log_success "Netlify CLI installed"
41
53
  }
42
54
 
43
55
  uninstall_netlify() {
56
+ if ! _netlify_is_owned; then
57
+ log_warn "Preserving Netlify CLI not managed by Karnel"
58
+ return 2
59
+ fi
44
60
  log_info "Uninstalling Netlify CLI..."
45
- npm uninstall -g netlify-cli &>/dev/null || {
46
- log_error "Failed to uninstall Netlify CLI"
61
+ if ! npm uninstall -g netlify-cli &>>"$LOG_FILE"; then
62
+ log_error "Failed to uninstall Netlify CLI (see $LOG_FILE)"
47
63
  return 1
48
- }
64
+ fi
65
+ rm -f "$NETLIFY_MARKER"
49
66
  log_success "Netlify CLI uninstalled"
50
67
  }
51
68
 
@@ -54,15 +71,21 @@ update_netlify() {
54
71
  }
55
72
 
56
73
  _do_update_netlify() {
57
- npm update -g netlify-cli &>/dev/null || {
58
- log_error "Failed to update Netlify CLI"
74
+ if ! _netlify_is_owned; then
75
+ log_warn "Skipping update: Netlify CLI not managed by Karnel"
76
+ return 2
77
+ fi
78
+ if ! npm update -g netlify-cli --legacy-peer-deps &>>"$LOG_FILE"; then
79
+ log_error "Failed to update Netlify CLI (see $LOG_FILE)"
59
80
  return 1
60
- }
81
+ fi
61
82
  command -v termux-fix-shebang &>/dev/null && termux-fix-shebang "$(command -v netlify)" &>/dev/null
62
83
  return 0
63
84
  }
64
85
 
65
86
  reinstall_netlify() {
66
87
  uninstall_netlify
88
+ local rc=$?
89
+ [[ "$rc" == 0 || "$rc" == 2 ]] || return "$rc"
67
90
  install_netlify
68
91
  }
@@ -1,5 +1,8 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
+ import "@/utils/log"
4
+ import "@/utils/version"
5
+
3
6
  _SUPABASE_VERSION="2.20.8"
4
7
  _SUPABASE_RELEASE_URL="https://github.com/supabase/cli/releases/download/v${_SUPABASE_VERSION}"
5
8
  _SUPABASE_BIN="$PREFIX/bin/supabase"
@@ -142,6 +145,8 @@ update_supabase() {
142
145
  }
143
146
 
144
147
  reinstall_supabase() {
145
- uninstall_supabase || return $?
148
+ uninstall_supabase
149
+ local rc=$?
150
+ [[ "$rc" == 0 || "$rc" == 2 ]] || return "$rc"
146
151
  install_supabase
147
152
  }
@@ -3,13 +3,20 @@
3
3
  import "@/utils/log"
4
4
  import "@/utils/version"
5
5
 
6
- VERCEL_BIN="$PREFIX/lib/node_modules/vercel/dist/vc.js"
6
+ LOG_FILE="${LOG_FILE:-${KARNEL_CACHE:-$HOME/.cache/karnel}/install_deploy.log}"
7
+
8
+ VERCEL_MARKER="$PREFIX/share/karnel-installers/vercel"
9
+
10
+ _vercel_is_owned() {
11
+ command -v vercel &>/dev/null && [[ -f "$VERCEL_MARKER" ]] || return 1
12
+ }
7
13
 
8
14
  install_vercel() {
9
- if [[ -f "$VERCEL_BIN" ]]; then
15
+ if command -v vercel &>/dev/null; then
10
16
  log_info "Vercel CLI is already installed"
11
17
  return 2
12
18
  fi
19
+ mkdir -p "$(dirname "$LOG_FILE")"
13
20
  if ! command -v node &>/dev/null || ! command -v npm &>/dev/null; then
14
21
  log_info "Installing Node.js..."
15
22
  if ! pkg install -y nodejs-lts &>>"$LOG_FILE"; then
@@ -18,20 +25,26 @@ install_vercel() {
18
25
  fi
19
26
  fi
20
27
  log_info "Installing Vercel CLI..."
21
- npm install -g vercel &>/dev/null || {
22
- log_error "Failed to install Vercel CLI"
28
+ if ! npm install -g vercel --legacy-peer-deps &>>"$LOG_FILE"; then
29
+ log_error "Failed to install Vercel CLI (see $LOG_FILE)"
23
30
  return 1
24
- }
31
+ fi
25
32
  command -v termux-fix-shebang &>/dev/null && termux-fix-shebang "$(command -v vercel)" &>/dev/null
33
+ mkdir -p "$(dirname "$VERCEL_MARKER")" && : >"$VERCEL_MARKER"
26
34
  log_success "Vercel CLI installed"
27
35
  }
28
36
 
29
37
  uninstall_vercel() {
38
+ if ! _vercel_is_owned; then
39
+ log_warn "Preserving Vercel CLI not managed by Karnel"
40
+ return 2
41
+ fi
30
42
  log_info "Uninstalling Vercel CLI..."
31
- npm uninstall -g vercel &>/dev/null || {
32
- log_error "Failed to uninstall Vercel CLI"
43
+ if ! npm uninstall -g vercel &>>"$LOG_FILE"; then
44
+ log_error "Failed to uninstall Vercel CLI (see $LOG_FILE)"
33
45
  return 1
34
- }
46
+ fi
47
+ rm -f "$VERCEL_MARKER"
35
48
  log_success "Vercel CLI uninstalled"
36
49
  }
37
50
 
@@ -40,15 +53,21 @@ update_vercel() {
40
53
  }
41
54
 
42
55
  _do_update_vercel() {
43
- npm update -g vercel &>/dev/null || {
44
- log_error "Failed to update Vercel CLI"
56
+ if ! _vercel_is_owned; then
57
+ log_warn "Skipping update: Vercel CLI not managed by Karnel"
58
+ return 2
59
+ fi
60
+ if ! npm update -g vercel --legacy-peer-deps &>>"$LOG_FILE"; then
61
+ log_error "Failed to update Vercel CLI (see $LOG_FILE)"
45
62
  return 1
46
- }
63
+ fi
47
64
  command -v termux-fix-shebang &>/dev/null && termux-fix-shebang "$(command -v vercel)" &>/dev/null
48
65
  return 0
49
66
  }
50
67
 
51
68
  reinstall_vercel() {
52
69
  uninstall_vercel
70
+ local rc=$?
71
+ [[ "$rc" == 0 || "$rc" == 2 ]] || return "$rc"
53
72
  install_vercel
54
73
  }
@@ -3,6 +3,8 @@
3
3
  import "@/utils/log"
4
4
  import "@/utils/version"
5
5
 
6
+ LOG_FILE="${LOG_FILE:-${KARNEL_CACHE:-$HOME/.cache/karnel}/install_editor.log}"
7
+
6
8
  # code-server - VS Code in the browser for Termux
7
9
  # Official docs: https://coder.com/docs/code-server
8
10
  # Termux install: pkg install tur-repo && pkg install code-server
@@ -17,16 +19,23 @@ install_code_server() {
17
19
 
18
20
  log_info "Installing code-server (VS Code for Termux)..."
19
21
 
22
+ mkdir -p "$(dirname "$LOG_FILE")"
23
+
20
24
  # Add tur-repo if not present (required for code-server on Termux)
21
25
  if ! pkg list-installed 2>/dev/null | grep -q tur-repo; then
22
26
  log_info "Adding tur-repo (required for code-server)..."
23
- pkg install -y tur-repo 2>/dev/null
27
+ if ! pkg install -y tur-repo &>>"$LOG_FILE"; then
28
+ log_error "Failed to add tur-repo (see $LOG_FILE)"
29
+ return 1
30
+ fi
24
31
  fi
25
32
 
26
- pkg install -y code-server 2>/dev/null
27
- local rc=$?
33
+ if ! pkg update -y &>>"$LOG_FILE"; then
34
+ log_error "Failed to refresh package lists (see $LOG_FILE)"
35
+ return 1
36
+ fi
28
37
 
29
- if [[ $rc -eq 0 ]] && command -v code-server &>/dev/null; then
38
+ if pkg install -y code-server &>>"$LOG_FILE" && command -v code-server &>/dev/null; then
30
39
  # Do not replace a user-managed configuration or its password.
31
40
  mkdir -p "$HOME/.config/code-server"
32
41
  chmod 700 "$HOME/.config/code-server"
@@ -47,7 +56,7 @@ CONF
47
56
  log_info "The generated password is stored in ~/.config/code-server/config.yaml (chmod 600)"
48
57
  return 0
49
58
  else
50
- log_error "code-server installation failed"
59
+ log_error "code-server installation failed (see $LOG_FILE)"
51
60
  return 1
52
61
  fi
53
62
  }
@@ -59,8 +68,11 @@ uninstall_code_server() {
59
68
  fi
60
69
 
61
70
  log_info "Uninstalling code-server..."
62
- pkg uninstall -y code-server 2>/dev/null
63
- return $?
71
+ if ! pkg uninstall -y code-server &>>"$LOG_FILE"; then
72
+ log_error "Failed to uninstall code-server (see $LOG_FILE)"
73
+ return 1
74
+ fi
75
+ return 0
64
76
  }
65
77
 
66
78
  update_code_server() {
@@ -80,7 +92,7 @@ _update_code_server_impl() {
80
92
  }
81
93
 
82
94
  reinstall_code_server() {
83
- uninstall_code_server 2>/dev/null
95
+ uninstall_code_server
84
96
  install_code_server
85
97
  return $?
86
98
  }
@@ -18,7 +18,7 @@ _install_rust_pkg_impl() {
18
18
  }
19
19
 
20
20
  install_rust() {
21
- if command -v rust &>/dev/null; then
21
+ if command -v rustc &>/dev/null; then
22
22
  log_info "Rust is already installed"
23
23
  return 2
24
24
  fi
@@ -13,7 +13,9 @@ _live_server_dependencies() {
13
13
 
14
14
  log_info "Installing Nodejs..."
15
15
  mkdir -p "$(dirname "$LOG_FILE")"
16
- pkg install nodejs-lts -y &>>"$LOG_FILE"
16
+ if ! pkg install nodejs-lts -y &>>"$LOG_FILE"; then
17
+ log_error "Failed to install Node.js (required by this tool)"; return 1
18
+ fi
17
19
  }
18
20
 
19
21
  _install_live_server_npm() {
@@ -37,8 +39,7 @@ install_live_server() {
37
39
 
38
40
  log_info "Installing Live Server..."
39
41
 
40
- _live_server_dependencies
41
-
42
+ _live_server_dependencies || return 1
42
43
  mkdir -p "$(dirname "$LOG_FILE")"
43
44
 
44
45
  _install_live_server_npm || return 1
@@ -28,7 +28,9 @@ _localtunnel_dependencies() {
28
28
  log_info "Installing Nodejs..."
29
29
 
30
30
  mkdir -p "$(dirname "$LOG_FILE")"
31
- pkg install nodejs-lts -y &>>"$LOG_FILE"
31
+ if ! pkg install nodejs-lts -y &>>"$LOG_FILE"; then
32
+ log_error "Failed to install Node.js (required by this tool)"; return 1
33
+ fi
32
34
  }
33
35
 
34
36
  _install_localtunnel_npm() {
@@ -53,8 +55,7 @@ install_localtunnel() {
53
55
  fi
54
56
  log_info "Installing Localtunnel..."
55
57
 
56
- _localtunnel_dependencies
57
-
58
+ _localtunnel_dependencies || return 1
58
59
  mkdir -p "$(dirname "$LOG_FILE")"
59
60
 
60
61
  _install_localtunnel_npm || return 1
@@ -13,7 +13,9 @@ _markserv_dependencies() {
13
13
 
14
14
  log_info "Installing Nodejs..."
15
15
  mkdir -p "$(dirname "$LOG_FILE")"
16
- pkg install nodejs-lts -y &>>"$LOG_FILE"
16
+ if ! pkg install nodejs-lts -y &>>"$LOG_FILE"; then
17
+ log_error "Failed to install Node.js (required by this tool)"; return 1
18
+ fi
17
19
  }
18
20
 
19
21
  _install_markserv_npm() {
@@ -36,8 +38,7 @@ install_markserv() {
36
38
  fi
37
39
  log_info "Installing Markserv..."
38
40
 
39
- _markserv_dependencies
40
-
41
+ _markserv_dependencies || return 1
41
42
  mkdir -p "$(dirname "$LOG_FILE")"
42
43
 
43
44
  _install_markserv_npm || return 1
@@ -13,7 +13,9 @@ _ncu_dependencies() {
13
13
 
14
14
  log_info "Installing Nodejs..."
15
15
  mkdir -p "$(dirname "$LOG_FILE")"
16
- pkg install nodejs-lts -y &>>"$LOG_FILE"
16
+ if ! pkg install nodejs-lts -y &>>"$LOG_FILE"; then
17
+ log_error "Failed to install Node.js (required by this tool)"; return 1
18
+ fi
17
19
  }
18
20
 
19
21
  _install_ncu_npm() {
@@ -36,8 +38,7 @@ install_ncu() {
36
38
  fi
37
39
  log_info "Installing NPM Check Updates..."
38
40
 
39
- _ncu_dependencies
40
-
41
+ _ncu_dependencies || return 1
41
42
  mkdir -p "$(dirname "$LOG_FILE")"
42
43
 
43
44
  _install_ncu_npm || return 1
@@ -13,7 +13,9 @@ _nestjs_dependencies() {
13
13
 
14
14
  log_info "Installing Nodejs..."
15
15
  mkdir -p "$(dirname "$LOG_FILE")"
16
- pkg install nodejs-lts -y &>>"$LOG_FILE"
16
+ if ! pkg install nodejs-lts -y &>>"$LOG_FILE"; then
17
+ log_error "Failed to install Node.js (required by this tool)"; return 1
18
+ fi
17
19
  }
18
20
 
19
21
  _install_nestjs_npm() {
@@ -36,8 +38,7 @@ install_nestjs() {
36
38
  fi
37
39
  log_info "Installing NestJS CLI..."
38
40
 
39
- _nestjs_dependencies
40
-
41
+ _nestjs_dependencies || return 1
41
42
  mkdir -p "$(dirname "$LOG_FILE")"
42
43
 
43
44
  _install_nestjs_npm || return 1
@@ -13,7 +13,9 @@ _ngrok_dependencies() {
13
13
 
14
14
  log_info "Installing Nodejs..."
15
15
  mkdir -p "$(dirname "$LOG_FILE")"
16
- pkg install nodejs-lts -y &>>"$LOG_FILE"
16
+ if ! pkg install nodejs-lts -y &>>"$LOG_FILE"; then
17
+ log_error "Failed to install Node.js (required by this tool)"; return 1
18
+ fi
17
19
  }
18
20
 
19
21
  _install_ngrok_npm() {
@@ -36,8 +38,7 @@ install_ngrok() {
36
38
  fi
37
39
  log_info "Installing Ngrok..."
38
40
 
39
- _ngrok_dependencies
40
-
41
+ _ngrok_dependencies || return 1
41
42
  mkdir -p "$(dirname "$LOG_FILE")"
42
43
 
43
44
  _install_ngrok_npm || return 1
@@ -13,7 +13,9 @@ _prettier_dependencies() {
13
13
 
14
14
  log_info "Installing Nodejs..."
15
15
  mkdir -p "$(dirname "$LOG_FILE")"
16
- pkg install nodejs-lts -y &>>"$LOG_FILE"
16
+ if ! pkg install nodejs-lts -y &>>"$LOG_FILE"; then
17
+ log_error "Failed to install Node.js (required by this tool)"; return 1
18
+ fi
17
19
  }
18
20
 
19
21
  _install_prettier_npm() {
@@ -36,8 +38,7 @@ install_prettier() {
36
38
  fi
37
39
  log_info "Installing Prettier..."
38
40
 
39
- _prettier_dependencies
40
-
41
+ _prettier_dependencies || return 1
41
42
  mkdir -p "$(dirname "$LOG_FILE")"
42
43
 
43
44
  _install_prettier_npm || return 1
@@ -13,7 +13,9 @@ _psqlformat_dependencies() {
13
13
 
14
14
  log_info "Installing Nodejs and Perl..."
15
15
  mkdir -p "$(dirname "$LOG_FILE")"
16
- pkg install nodejs-lts perl -y &>>"$LOG_FILE"
16
+ if ! pkg install nodejs-lts -y &>>"$LOG_FILE"; then
17
+ log_error "Failed to install Node.js (required by this tool)"; return 1
18
+ fi
17
19
  }
18
20
 
19
21
  _install_psqlformat_npm() {
@@ -36,8 +38,7 @@ install_psqlformat() {
36
38
  fi
37
39
  log_info "Installing PSQL Format..."
38
40
 
39
- _psqlformat_dependencies
40
-
41
+ _psqlformat_dependencies || return 1
41
42
  mkdir -p "$(dirname "$LOG_FILE")"
42
43
 
43
44
  _install_psqlformat_npm || return 1
@@ -13,7 +13,9 @@ _typescript_dependencies() {
13
13
 
14
14
  log_info "Installing Nodejs..."
15
15
  mkdir -p "$(dirname "$LOG_FILE")"
16
- pkg install nodejs-lts -y &>>"$LOG_FILE"
16
+ if ! pkg install nodejs-lts -y &>>"$LOG_FILE"; then
17
+ log_error "Failed to install Node.js (required by this tool)"; return 1
18
+ fi
17
19
  }
18
20
 
19
21
  _install_typescript_npm() {
@@ -36,8 +38,7 @@ install_typescript() {
36
38
  fi
37
39
  log_info "Installing TypeScript..."
38
40
 
39
- _typescript_dependencies
40
-
41
+ _typescript_dependencies || return 1
41
42
  mkdir -p "$(dirname "$LOG_FILE")"
42
43
 
43
44
  _install_typescript_npm || return 1
@@ -13,7 +13,9 @@ _vercel_dependencies() {
13
13
 
14
14
  log_info "Installing Nodejs..."
15
15
  mkdir -p "$(dirname "$LOG_FILE")"
16
- pkg install nodejs-lts -y &>>"$LOG_FILE"
16
+ if ! pkg install nodejs-lts -y &>>"$LOG_FILE"; then
17
+ log_error "Failed to install Node.js (required by this tool)"; return 1
18
+ fi
17
19
  }
18
20
 
19
21
  _install_vercel_npm() {
@@ -36,8 +38,7 @@ install_vercel() {
36
38
  fi
37
39
  log_info "Installing Vercel CLI..."
38
40
 
39
- _vercel_dependencies
40
-
41
+ _vercel_dependencies || return 1
41
42
  mkdir -p "$(dirname "$LOG_FILE")"
42
43
 
43
44
  _install_vercel_npm || return 1
@@ -3,6 +3,15 @@
3
3
  import "@/utils/log"
4
4
 
5
5
  _uninstall_voice_tool() {
6
- log_info "Termux:API can be removed with: pkg uninstall termux-api"
6
+ if command -v termux-api &>/dev/null; then
7
+ log_info "Removing Termux:API..."
8
+ if ! pkg uninstall -y termux-api &>>"$LOG_FILE"; then
9
+ log_error "Failed to remove Termux:API (see $LOG_FILE)"
10
+ return 1
11
+ fi
12
+ log_success "Termux:API removed"
13
+ else
14
+ log_info "Termux:API is not installed"
15
+ fi
7
16
  return 0
8
17
  }
@@ -436,11 +436,11 @@ loading() {
436
436
 
437
437
  printf " ${CYAN}⠋${D_CYAN} %s${NC}" "$message"
438
438
 
439
+ mkdir -p "$KARNEL_CACHE"
440
+
439
441
  "$@" >"$tmpfile" 2>&1 &
440
442
  cmd_pid=$!
441
443
 
442
- mkdir -p "$KARNEL_CACHE"
443
-
444
444
  local frame_idx=0
445
445
  while kill -0 "$cmd_pid" 2>/dev/null; do
446
446
  printf "\r ${CYAN}%s${D_CYAN} %s${NC}" "${frames[$frame_idx]}" "$message"
@@ -8,9 +8,23 @@ confirm_remove_paths() {
8
8
  local -a existing=()
9
9
 
10
10
  for path in "$@"; do
11
- [[ -e "$path" || -L "$path" ]] && existing+=("$path")
11
+ [[ -e "$path" || -L "$path" ]] || continue
12
+ # Ownership gate: refuse to remove a path that is not managed by Karnel unless
13
+ # explicitly forced. This prevents silently deleting a user's own directory
14
+ # (e.g. a pre-existing ~/.oh-my-zsh or ~/.zsh-plugins/<plugin>).
15
+ if [[ -z "${KARNEL_FORCE:-}" ]]; then
16
+ local owned=0
17
+ for marker in "$path/.karnel-managed" "$path/.karnel-pinned-git" "$path/.managed-by-karnel"; do
18
+ [[ -f "$marker" ]] && owned=1 && break
19
+ done
20
+ if (( owned == 0 )); then
21
+ log_warn "Preserving $label at $path (not managed by Karnel)"
22
+ continue
23
+ fi
24
+ fi
25
+ existing+=("$path")
12
26
  done
13
- (( ${#existing[@]} > 0 )) || return 0
27
+ (( ${#existing[@]} > 0 )) || return 2
14
28
 
15
29
  read_confirm_default "Remove $label configuration and data?" "$default" answer || return 2
16
30
  [[ "$answer" == "y" ]] || return 2
@@ -176,31 +176,31 @@ _check_update_needed() {
176
176
  local remote_ver="$3"
177
177
  local update_func="$4"
178
178
 
179
- if [ -z "$installed_ver" ]; then
180
- log_warn "$display_name: could not detect installed version"
181
- echo
182
- local confirm_var
183
- read_confirm_default "Update $display_name anyway?" "y" confirm_var
184
- if [ "$confirm_var" = "y" ]; then
185
- $update_func
186
- return $?
187
- fi
188
- log_info "Skipped $display_name"
189
- return 0
190
- fi
191
-
192
- if [ -z "$remote_ver" ]; then
193
- log_warn "$display_name: could not detect remote version"
194
- echo
195
- local confirm_var
196
- read_confirm_default "Update $display_name anyway?" "y" confirm_var
197
- if [ "$confirm_var" = "y" ]; then
198
- $update_func
199
- return $?
200
- fi
201
- log_info "Skipped $display_name"
202
- return 0
203
- fi
179
+ if [ -z "$installed_ver" ]; then
180
+ log_warn "$display_name: could not detect installed version"
181
+ echo
182
+ local confirm_var
183
+ read_confirm_default "Update $display_name anyway?" "n" confirm_var
184
+ if [ "$confirm_var" = "y" ]; then
185
+ $update_func
186
+ return $?
187
+ fi
188
+ log_info "Skipped $display_name"
189
+ return 0
190
+ fi
191
+
192
+ if [ -z "$remote_ver" ]; then
193
+ log_warn "$display_name: could not detect remote version"
194
+ echo
195
+ local confirm_var
196
+ read_confirm_default "Update $display_name anyway?" "n" confirm_var
197
+ if [ "$confirm_var" = "y" ]; then
198
+ $update_func
199
+ return $?
200
+ fi
201
+ log_info "Skipped $display_name"
202
+ return 0
203
+ fi
204
204
 
205
205
  if _compare_versions "$installed_ver" "$remote_ver"; then
206
206
  log_success "$display_name is already up to date (${D_GREEN}v${installed_ver}${D_NC})"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "karnel-termux",
3
- "version": "4.17.5",
3
+ "version": "4.17.6",
4
4
  "description": "Modular Dev Environment for Termux — install languages, databases, AI agents, editors, and more with one command",
5
5
  "bin": {
6
6
  "karnel": "karnel/bin/karnel"
package/docs/README.md DELETED
@@ -1,35 +0,0 @@
1
- # Karnel Termux Documentation
2
-
3
- > Modular Dev Environment for Termux — install languages, databases, AI agents, editors, and more with one command
4
-
5
- ## Quick Links
6
-
7
- - [CLI Commands](./cli/README.md) — All `karnel` subcommands
8
- - [Doctor System](./doctor/README.md) — Environment diagnosis and code analysis
9
- - [Troubleshooting](./troubleshooting.md) — Common issues and fixes
10
- - [Architecture Overview](./ARCHITECTURE.md)
11
- - [Bug Fixes & Changelog](./CHANGELOG.md)
12
- - [Official Documentation Site](https://karneltermux.vercel.app/karnel/doctor)
13
-
14
- ## What is Karnel?
15
-
16
- Karnel Termux transforms your Android device into a complete development workstation.
17
- With a single CLI (`karnel`), you can install and manage 43 AI tools, 8 languages,
18
- 5 databases, 22 dev tools, 12 utility tools, 2 network tools, 6 games, responsible OSINT, and more.
19
-
20
- ## Sections
21
-
22
- - **[CLI Commands](./cli/README.md)** — Full reference for every `karnel` subcommand
23
- - **[Doctor System](./doctor/README.md)** — How `karnel doctor` works, code analysis engine, environment checks
24
- - **[Robin OSINT](../karnel/tools/osint/robin/README.md)** — Responsible use, lifecycle, data locations, and troubleshooting
25
- - **[Network Tools](../karnel/tools/network/dark/README.md)** — dark, dedsec-network
26
- - **[KeelCode](../karnel/tools/ai/keelcode/README.md)** — Hosted coding-agent CLI: `karnel install ai --keelcode`
27
- - **[SuperFile](../karnel/tools/utils/superfile/README.md)** — Terminal file manager: `karnel install utils --superfile`
28
- - **[Utility Scripts](../karnel/tools/utils/fconv/README.md)** — fconv, notes, treex, SuperFile, passman, applaunch, splash, httptmux, zork, qrcode and more
29
- - **[Supabase CLI](./cli/README.md#supabase--remote-project-helpers)** — `karnel supabase` remote-project helpers
30
- - **[Architecture](./ARCHITECTURE.md)** — Project structure, module system, import mechanism
31
- - **[Changelog](./CHANGELOG.md)** — Version history, bug fixes, known issues
32
-
33
- ## Credits
34
-
35
- Created by **Israel Marques**. Core agent contributions by **devcorex**.
File without changes
File without changes