karnel-termux 4.13.4 → 4.13.5

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.
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.13.4-0078D4?style=for-the-badge" alt="Version">
11
+ <img src="https://img.shields.io/badge/version-4.13.5-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">
@@ -473,6 +473,7 @@ Documentation loads from https://karneltermux.vercel.app.
473
473
  - [Documentation index](docs/README.md)
474
474
  - [CLI reference](docs/cli/README.md)
475
475
  - [Doctor reference](docs/doctor/README.md)
476
+ - [Troubleshooting](docs/troubleshooting.md)
476
477
  - [Architecture](docs/ARCHITECTURE.md)
477
478
  - [Documentation changelog](docs/CHANGELOG.md)
478
479
  - [Official website](https://karneltermux.vercel.app)
@@ -570,9 +571,11 @@ karnel update karnel # Update the framework
570
571
 
571
572
  `karnel update` requires a target such as `karnel`, `ai`, or `security`.
572
573
  `karnel update karnel` first runs the official curl installer, then falls back to
573
- the local Git checkout and package-manager installs if needed. The framework
574
- checks for a new version in the background at most once every 24 hours; the check
575
- can use npm or GitHub and writes state under `$KARNEL_CACHE`.
574
+ the local Git checkout and package-manager installs if needed. The curl installer
575
+ is pinned to the latest GitHub release tag, and its SHA-256 checksum is verified
576
+ before it runs. The framework checks for a new version in the background at most
577
+ once every 24 hours; the check can use npm or GitHub and writes state under
578
+ `$KARNEL_CACHE`.
576
579
 
577
580
  ---
578
581
 
@@ -188,8 +188,8 @@ _list_ai() {
188
188
  table_row "Kimi Code" "--kimi-code" "kimi" "$(_check_cmd "kimi")"
189
189
  table_row "Command Code" "--command-code" "command-code" "$(_check_cmd "command-code")"
190
190
  table_row "Freebuff" "--freebuff" "freebuff" "$(_check_cmd "freebuff")"
191
- table_row "Kilo Code CLI" "--kilocode-cli" "kilocode" "$(_check_cmd "kilocode")"
192
- table_row "Kiro CLI" "--kiro" "kiro" "$(_check_cmd "kiro")"
191
+ table_row "Kilo Code CLI" "--kilocode-cli" "kilocode,kilo" "$(_check_cmd_any "kilocode,kilo")"
192
+ table_row "Kiro CLI" "--kiro" "kiro,kiro-cli" "$(_check_cmd_any "kiro,kiro-cli")"
193
193
  table_row "Crush CLI" "--crush" "crush" "$(_check_cmd "crush")"
194
194
  table_row "Cline CLI" "--cline" "cline" "$(_check_cmd "cline")"
195
195
  table_row "Odysseus" "--odysseus" "odysseus" "$(_check_cmd "odysseus")"
@@ -199,7 +199,7 @@ _list_ai() {
199
199
  table_row "OpenSpec SDD" "--openspec" "openspec" "$(_check_cmd "openspec")"
200
200
  table_row "Qoder" "--qoder" "qodercli" "$(_check_cmd "qodercli")"
201
201
  table_row "AMP Code CLI" "--ampcode" "amp" "$(_check_cmd "amp")"
202
- table_row "Cursor CLI" "--cursor-cli" "cursor" "$(_check_cmd "cursor")"
202
+ table_row "Cursor CLI" "--cursor-cli" "cursor,cursor-agent" "$(_check_cmd_any "cursor,cursor-agent")"
203
203
  table_row "Oh-My-Pi" "--oh-my-pi" "omp" "$(_check_cmd "omp")"
204
204
  table_row "Goose CLI" "--goose" "goose" "$(_check_cmd "goose")"
205
205
  table_row "Factory Droid" "--droid" "droid" "$(_check_cmd "droid")"
@@ -467,6 +467,20 @@ _check_cmd() {
467
467
  fi
468
468
  }
469
469
 
470
+ # Check if any of the comma-separated commands exists
471
+ _check_cmd_any() {
472
+ local bin_list="$1"
473
+ local bin
474
+ IFS=',' read -ra bins <<< "$bin_list"
475
+ for bin in "${bins[@]}"; do
476
+ if command -v "$bin" &>/dev/null; then
477
+ echo -e "${D_GREEN}installed${NC}"
478
+ return 0
479
+ fi
480
+ done
481
+ echo -e "${D_RED}not installed${NC}"
482
+ }
483
+
470
484
  # Check if package is installed via pkg
471
485
  _check_pkg() {
472
486
  local pkg="$1"
@@ -212,20 +212,48 @@ _update_cleanup() {
212
212
  _update_try_curl() {
213
213
  command -v curl &>/dev/null || return 1
214
214
 
215
- local installer
216
- installer=$(mktemp "${TMPDIR:-/tmp}/karnel-install.XXXXXX") || return 1
215
+ local meta installer sumfile tag
216
+ meta=$(mktemp "${TMPDIR:-/tmp}/karnel-meta.XXXXXX") || return 1
217
+ installer=$(mktemp "${TMPDIR:-/tmp}/karnel-install.XXXXXX") || { rm -f "$meta"; return 1; }
218
+ sumfile=$(mktemp "${TMPDIR:-/tmp}/karnel-sum.XXXXXX") || { rm -f "$meta" "$installer"; return 1; }
217
219
 
218
220
  log_info "Trying the official curl installer..."
221
+
219
222
  if ! curl --fail --silent --show-error --location \
220
- "https://raw.githubusercontent.com/israelmarques1024-dotcom/karnel-termux/main/install.sh" \
223
+ "https://api.github.com/repos/israelmarques1024-dotcom/karnel-termux/releases/latest" \
224
+ -o "$meta"; then
225
+ rm -f "$meta" "$installer" "$sumfile"
226
+ return 1
227
+ fi
228
+
229
+ tag=$(_update_latest_release_tag "$meta")
230
+ if [[ -z "$tag" || ! "$tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
231
+ log_error "GitHub returned an invalid release tag: ${tag:-none}"
232
+ rm -f "$meta" "$installer" "$sumfile"
233
+ return 1
234
+ fi
235
+
236
+ if ! curl --fail --silent --show-error --location \
237
+ "https://github.com/israelmarques1024-dotcom/karnel-termux/releases/download/$tag/karnel-termux-install.sh.sha256" \
238
+ -o "$sumfile" ||
239
+ ! curl --fail --silent --show-error --location \
240
+ "https://github.com/israelmarques1024-dotcom/karnel-termux/releases/download/$tag/karnel-termux-install.sh" \
221
241
  -o "$installer"; then
222
- rm -f "$installer"
242
+ rm -f "$meta" "$installer" "$sumfile"
243
+ return 1
244
+ fi
245
+
246
+ if ! _verify_sha256 "$installer" "$sumfile"; then
247
+ log_error "Checksum verification failed for the curl installer"
248
+ rm -f "$meta" "$installer" "$sumfile"
223
249
  return 1
224
250
  fi
225
251
 
252
+ rm -f "$meta" "$sumfile"
253
+
226
254
  if bash "$installer"; then
227
255
  rm -f "$installer"
228
- log_success "Karnel-Termux updated via curl"
256
+ log_success "Karnel-Termux updated via curl (v$tag)"
229
257
  return 0
230
258
  fi
231
259
 
@@ -234,6 +262,41 @@ _update_try_curl() {
234
262
  return 1
235
263
  }
236
264
 
265
+ _update_latest_release_tag() {
266
+ local meta="$1"
267
+ if command -v node &>/dev/null; then
268
+ node -e '
269
+ let s = "";
270
+ process.stdin.resume();
271
+ process.stdin.on("data", (d) => { s += d; });
272
+ process.stdin.on("end", () => {
273
+ try { process.stdout.write(JSON.parse(s).tag_name || ""); } catch (e) {}
274
+ });
275
+ ' < "$meta"
276
+ return
277
+ fi
278
+ grep -oP '"tag_name":\s*"\K[^"]+' "$meta" 2>/dev/null | head -n 1
279
+ }
280
+
281
+ _verify_sha256() {
282
+ local file="$1" sumfile="$2"
283
+ local expected actual
284
+ expected=$(awk 'NR == 1 { print $1 }' "$sumfile")
285
+ [[ -n "$expected" ]] || return 1
286
+ if command -v sha256sum &>/dev/null; then
287
+ actual=$(sha256sum "$file" | awk '{ print $1 }')
288
+ elif command -v node &>/dev/null; then
289
+ actual=$(node -e '
290
+ const fs = require("fs");
291
+ const crypto = require("crypto");
292
+ process.stdout.write(crypto.createHash("sha256").update(fs.readFileSync(process.argv[1])).digest("hex"));
293
+ ' "$file")
294
+ else
295
+ return 1
296
+ fi
297
+ [[ "$actual" == "$expected" ]]
298
+ }
299
+
237
300
  _update_try_git() {
238
301
  [[ -d "$KARNEL_PATH/../.git" ]] || return 1
239
302
  loading "Updating via git" _update_karnel_repo
@@ -29,7 +29,7 @@ _freebuff_proot_ubuntu() {
29
29
 
30
30
  _get_latest_freebuff_version() {
31
31
  curl -fsSL https://api.github.com/repos/CodebuffAI/codebuff-community/releases/latest |
32
- grep '"tag_name":' | sed -E 's/.*"freebuff-v([^"]+)".*/\1/'
32
+ grep '"tag_name":' | sed -E 's/.*"tag_name":\s*"v([0-9]+\.[0-9]+\.[0-9]+)".*/\1/'
33
33
  }
34
34
 
35
35
  _freebuff_install_deps_native() {
@@ -86,8 +86,8 @@ _download_freebuff_binary_impl() {
86
86
 
87
87
  mkdir -p "$FREEBUFF_DATA_DIR"
88
88
 
89
- local tarball="freebuff-linux-arm64.tar.gz"
90
- local download_url="https://codebuff.com/api/releases/download/$latest_version/$tarball"
89
+ local tarball="codebuff-linux-arm64.tar.gz"
90
+ local download_url="https://github.com/CodebuffAI/codebuff-community/releases/download/v${latest_version}/${tarball}"
91
91
 
92
92
  if ! curl -fsSL "$download_url" -o "$FREEBUFF_DATA_DIR/$tarball" &>>"$LOG_FILE"; then
93
93
  log_error "Failed to download Freebuff binary"
@@ -101,11 +101,12 @@ _download_freebuff_binary_impl() {
101
101
 
102
102
  rm -f "$FREEBUFF_DATA_DIR/$tarball"
103
103
 
104
- if [ ! -f "$FREEBUFF_DATA_DIR/freebuff" ]; then
104
+ if [ ! -f "$FREEBUFF_DATA_DIR/codebuff" ]; then
105
105
  log_error "Freebuff binary not found after extraction"
106
106
  return 1
107
107
  fi
108
108
 
109
+ mv -f "$FREEBUFF_DATA_DIR/codebuff" "$FREEBUFF_DATA_DIR/freebuff"
109
110
  chmod +x "$FREEBUFF_DATA_DIR/freebuff"
110
111
  return 0
111
112
  }
@@ -161,11 +162,12 @@ _install_freebuff_proot_impl() {
161
162
  export SHELL=/bin/bash
162
163
  export TMPDIR=/tmp
163
164
  export HOME=/root
164
- LATEST=$(curl -fsSL https://api.github.com/repos/CodebuffAI/codebuff-community/releases/latest | grep '"'"'tag_name'"'"' | sed -E '"'"'s/.*"freebuff-v([^"]+)".*/\1/'"'"')
165
+ LATEST=$(curl -fsSL https://api.github.com/repos/CodebuffAI/codebuff-community/releases/latest | grep '"'"'tag_name'"'"' | sed -E '"'"'s/.*"tag_name":\s*"v([0-9]+\.[0-9]+\.[0-9]+)".*/\1/'"'"')
165
166
  TARBALL=$(mktemp /tmp/freebuff.XXXXXX.tar.gz)
166
- curl -fsSL "https://codebuff.com/api/releases/download/${LATEST}/freebuff-linux-arm64.tar.gz" -o "$TARBALL"
167
+ curl -fsSL "https://github.com/CodebuffAI/codebuff-community/releases/download/v${LATEST}/codebuff-linux-arm64.tar.gz" -o "$TARBALL"
167
168
  mkdir -p /root/.freebuff
168
169
  tar -zxf "$TARBALL" -C /root/.freebuff
170
+ mv -f /root/.freebuff/codebuff /root/.freebuff/freebuff
169
171
  rm -f "$TARBALL"
170
172
  chmod +x /root/.freebuff/freebuff
171
173
  ' &>>"$LOG_FILE"
@@ -277,11 +279,12 @@ _update_freebuff_impl() {
277
279
  export SHELL=/bin/bash
278
280
  export TMPDIR=/tmp
279
281
  export HOME=/root
280
- LATEST=$(curl -fsSL https://api.github.com/repos/CodebuffAI/codebuff-community/releases/latest | grep '"'"'tag_name'"'"' | sed -E '"'"'s/.*"freebuff-v([^"]+)".*/\1/'"'"')
282
+ LATEST=$(curl -fsSL https://api.github.com/repos/CodebuffAI/codebuff-community/releases/latest | grep '"'"'tag_name'"'"' | sed -E '"'"'s/.*"tag_name":\s*"v([0-9]+\.[0-9]+\.[0-9]+)".*/\1/'"'"')
281
283
  TARBALL=$(mktemp /tmp/freebuff.XXXXXX.tar.gz)
282
- curl -fsSL "https://codebuff.com/api/releases/download/${LATEST}/freebuff-linux-arm64.tar.gz" -o "$TARBALL"
284
+ curl -fsSL "https://github.com/CodebuffAI/codebuff-community/releases/download/v${LATEST}/codebuff-linux-arm64.tar.gz" -o "$TARBALL"
283
285
  mkdir -p /root/.freebuff
284
286
  tar -zxf "$TARBALL" -C /root/.freebuff
287
+ mv -f /root/.freebuff/codebuff /root/.freebuff/freebuff
285
288
  rm -f "$TARBALL"
286
289
  chmod +x /root/.freebuff/freebuff
287
290
  ' &>>"$LOG_FILE"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "karnel-termux",
3
- "version": "4.13.4",
3
+ "version": "4.13.5",
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"