karnel-termux 4.17.10 → 4.17.13

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 (40) hide show
  1. package/README.md +25 -7
  2. package/docs/ARCHITECTURE/index.md +1 -1
  3. package/docs/CHANGELOG.md +26 -0
  4. package/docs/_config.yml +0 -2
  5. package/docs/_layouts/base.html +6 -0
  6. package/docs/cli/index.md +6 -6
  7. package/docs/index.md +9 -1
  8. package/docs/karnel/ai/index.md +17 -0
  9. package/docs/karnel/auto/index.md +17 -0
  10. package/docs/karnel/db/index.md +17 -0
  11. package/docs/karnel/deploy/index.md +17 -0
  12. package/docs/karnel/dev/index.md +17 -0
  13. package/docs/karnel/editor/index.md +17 -0
  14. package/docs/karnel/games/index.md +17 -0
  15. package/docs/karnel/lang/index.md +17 -0
  16. package/docs/karnel/network/index.md +17 -0
  17. package/docs/karnel/npm/index.md +17 -0
  18. package/docs/karnel/osint/index.md +17 -0
  19. package/docs/karnel/plugin/index.md +17 -0
  20. package/docs/karnel/security/index.md +17 -0
  21. package/docs/karnel/shell/index.md +17 -0
  22. package/docs/karnel/ui/index.md +17 -0
  23. package/docs/karnel/utils/index.md +21 -0
  24. package/docs/karnel/voice/index.md +17 -0
  25. package/karnel/RELEASE_COMMIT +1 -1
  26. package/karnel/bin/karnel +1 -1
  27. package/karnel/cli/commands/doctor/code_exec.sh +4 -0
  28. package/karnel/cli/commands/doctor/fixes.sh +14 -2
  29. package/karnel/cli/commands/doctor.sh +33 -8
  30. package/karnel/cli/commands/open.sh +31 -74
  31. package/karnel/cli/commands/pg.sh +6 -2
  32. package/karnel/modules/shell.sh +1 -1
  33. package/karnel/tools/ai/cursor-cli/install.sh +2 -1
  34. package/karnel/tools/ai/hermes-agent/install.sh +1 -1
  35. package/karnel/tools/utils/all.sh +2 -0
  36. package/karnel/tools/utils/herdr/README.md +33 -0
  37. package/karnel/tools/utils/herdr/install.sh +160 -0
  38. package/package.json +2 -2
  39. package/scripts/completion.bash +1 -1
  40. package/scripts/completion.zsh +1 -1
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.17.10-0078D4?style=for-the-badge" alt="Version">
11
+ <img src="https://img.shields.io/badge/version-4.17.13-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">
@@ -39,7 +39,7 @@ Core agent contributions by **devcorex**.
39
39
  - **8 languages** — Node.js, Python, Go, Rust, C/C++, PHP, Perl, Bun
40
40
  - **5 databases** — PostgreSQL, MariaDB, SQLite, MongoDB, Redis
41
41
  - **22 dev tools** — gh, curl, fzf, bat, lsd, jq, tmux, openssh, snyk and more
42
- - **12 utility tools** — fconv, notes, treex, qrcode, SuperFile, zork and more
42
+ - **13 utility tools** — fconv, notes, treex, qrcode, SuperFile, zork, herdr and more
43
43
  - **2 network tools** — dark, dedsec-network
44
44
  - **4 deploy CLIs** — Vercel, Railway, Netlify, Supabase
45
45
  - **Responsible OSINT** — Robin v2.8 through Tor with a loopback-only web UI
@@ -54,6 +54,23 @@ Core agent contributions by **devcorex**.
54
54
 
55
55
 
56
56
 
57
+ ---
58
+
59
+ ## 🌟 Featured: Herdr — terminal AI assistant
60
+
61
+ Karnel now ships **[Herdr](https://herdr.dev)**, a blazing-fast terminal AI assistant CLI, as a first-class utility. Install it with:
62
+
63
+ ```bash
64
+ karnel install utils --herdr
65
+ ```
66
+
67
+ Why it's great:
68
+ - **Checksum-verified** download from the official Herdr release manifest (`https://herdr.dev/latest.json`).
69
+ - **Atomic, safe install** into `$PREFIX/bin/herdr` with a Karnel ownership marker — so `karnel uninstall utils --herdr` is clean and never touches files it didn't manage.
70
+ - Pairs perfectly with the 45+ other AI agents Karnel manages.
71
+
72
+ > Open its docs anytime with `karnel open herdr`.
73
+
57
74
  ---
58
75
 
59
76
  ## Installation
@@ -61,7 +78,7 @@ Core agent contributions by **devcorex**.
61
78
  ### Via checksummed GitHub release (recommended)
62
79
 
63
80
  ```bash
64
- version=4.17.10
81
+ version=4.17.11
65
82
  tmpdir=$(mktemp -d) && trap 'rm -rf "$tmpdir"' EXIT
66
83
  base="https://github.com/israelmarques1024-dotcom/karnel-termux/releases/download/v$version"
67
84
  curl -fsSL "$base/karnel-termux-install.sh" -o "$tmpdir/karnel-termux-install.sh"
@@ -106,6 +123,7 @@ aliases, or options; use `karnel help` and the CLI reference for the full set.
106
123
  | `karnel update <module>` | Update modules or karnel |
107
124
  | `karnel uninstall <module>` | Remove installed modules |
108
125
  | `karnel reinstall <module>` | Reinstall modules |
126
+ | `karnel upgrade` | Upgrade the framework (self-update) |
109
127
  | `karnel doctor termux` | Diagnose the Termux environment (30+ sections) |
110
128
  | `karnel doctor code` | Detect project ecosystems and run code checks |
111
129
  | `karnel doctor robin` | Diagnose Robin, Tor, dependencies, and local UI |
@@ -152,7 +170,7 @@ aliases, or options; use `karnel help` and the CLI reference for the full set.
152
170
  karnel install ai --keelcode
153
171
 
154
172
  # Install the SuperFile terminal file manager
155
- karnel install utils --superfile
173
+ karnel install utils --superfile --herdr
156
174
  ```
157
175
 
158
176
  Both tools support `update`, `reinstall`, and `uninstall` with the same module and flag.
@@ -343,7 +361,7 @@ karnel doctor termux --quick # Run essential system/package checks only
343
361
  karnel doctor termux --fix # Apply queued fixes without group confirmation
344
362
 
345
363
  karnel doctor code # Quick project analysis
346
- karnel doctor code --standard . # Add security, deps, coverage and complexity
364
+ karnel doctor code --standard . # Add security, deps, dead-code and complexity
347
365
  karnel doctor code --deep --json . # All 76 definitions as standalone JSON
348
366
  karnel doctor code --fix . # Apply fixes classified as safe
349
367
  karnel doctor robin # Robin/Tor/dependency diagnostics
@@ -430,7 +448,7 @@ Microphone -> termux-speech-to-text -> editor (edit) -> clipboard -> AI agent
430
448
  ### Requirements
431
449
 
432
450
  - Termux:API: `pkg install termux-api`
433
- - App Termux:API: https://karneltermux.vercel.app/termux/api
451
+ - App Termux:API: https://israelmarques1024-dotcom.github.io/karnel-termux/termux/api
434
452
  - Editor (optional): `karnel install editor`; otherwise use `--raw` or the automatic raw fallback
435
453
 
436
454
  ---
@@ -574,7 +592,7 @@ karnel/
574
592
  │ │ ├── ui/ # 4 UI components
575
593
  │ │ ├── auto/ # 1 automation tool
576
594
  │ │ ├── network/ # 2 network tools
577
- │ │ ├── utils/ # 12 utility tools
595
+ │ │ ├── utils/ # 13 utility tools
578
596
  │ │ ├── games/ # 6 games
579
597
  │ │ ├── security/ # 30 security tools
580
598
  │ │ └── deploy/ # 4 deploy CLIs
@@ -45,7 +45,7 @@ karnel-termux/
45
45
  │ │ ├── deploy/ # 4 deploy CLIs
46
46
  │ │ ├── games/ # 6 games
47
47
  │ │ ├── network/ # 2 network tools (dark, dedsec-network)
48
- │ │ ├── utils/ # 12 utility tools (fconv, notes, zork, SuperFile, etc.)
48
+ │ │ ├── utils/ # 13 utility tools (fconv, notes, zork, SuperFile, herdr, etc.)
49
49
  │ │ ├── security/ # 30 security tools
50
50
  │ │ ├── voice/ # Speech-to-agent via Termux:API
51
51
  │ │ ├── plugins/ # Built-in plugin manager
package/docs/CHANGELOG.md CHANGED
@@ -6,6 +6,32 @@ layout: base
6
6
 
7
7
  # Documentation Changelog
8
8
 
9
+ ## 4.17.13
10
+
11
+ - Fixed the shell completion catalog (`scripts/completion.bash` / `completion.zsh`) to include the `herdr` utils tool, satisfying the `completion-catalog` CI gate.
12
+
13
+ ## 4.17.12
14
+
15
+ - Generated real per-module documentation pages under `/karnel/<module>/` (all 17 modules: ai, auto, db, deploy, dev, editor, games, lang, network, npm, osint, plugin, security, shell, ui, utils, voice).
16
+ - `karnel open <module>` now opens the in-site page (`/karnel/<module>/`) instead of the GitHub source; added a dedicated `herdr` open target that opens the utils page.
17
+ - Featured **Herdr** prominently in the README and on the site landing page, with a `karnel install utils --herdr` callout.
18
+ - Added `karnel/tools/utils/herdr/README.md` so `karnel show utils --herdr` renders proper documentation.
19
+ - Site/CLI audit: fixed the stale "12 scripts" utils summary in the CLI reference (now lists all 13 tools including Herdr).
20
+
21
+ ## 4.17.11
22
+
23
+ - Added the **Herdr** CLI to the `utils` module (`karnel install utils --herdr`), with checksum-verified download, atomic install, and Karnel ownership markers.
24
+ - Critical runtime fixes:
25
+ - `cursor-cli`, `hermes-agent` and the `doctor` psutil patch now extract archives with the guarded `safe_extract_tar` (path-traversal/symlink protection).
26
+ - `pg schedule` now exports `PATH`/`PREFIX` in the cron job and logs failures instead of discarding output.
27
+ - `pg restore` uses `--single-transaction` and surfaces errors instead of silently retrying.
28
+ - `doctor --fix` no longer auto-applies destructive fixes (install-class, cache wipes, mass symlink deletion) without explicit confirmation; non-interactive sessions skip them (fail-closed).
29
+ - `doctor code --fix` now snapshots each rewritten file to `<file>.karnel-bak` before applying in-place formatters.
30
+ - `_fix_broken_symlinks` only removes broken symlinks that point into Karnel-managed paths.
31
+ - `karnel upgrade` no longer triggers a concurrent update check.
32
+ - `shell.sh` temp directory falls back to `KARNEL_CACHE` instead of `/tmp`.
33
+ - Website/documentation overhaul: `karnel open` now resolves to real GitHub source URLs (no more 404s), canonical site URL unified to GitHub Pages, utility-tool count corrected to 13 (Herdr added), cloud-backup docs corrected to rclone, added `karnel upgrade` to the command table, and added favicon/SEO meta + Troubleshooting nav.
34
+
9
35
  ## 4.17.10
10
36
 
11
37
  - Round 10 security/correctness hardening (23 distinct fixes):
package/docs/_config.yml CHANGED
@@ -6,8 +6,6 @@ author: Israel Marques
6
6
  lang: en-US
7
7
  theme: jekyll-theme-cayman
8
8
  markdown: kramdown
9
- logo: /assets/images/karnel-logo.png
10
- custom_css: /karnel-termux/assets/css/style.css
11
9
  baseurl: /karnel-termux
12
10
  show_downloads: false
13
11
  exclude:
@@ -2,6 +2,12 @@
2
2
  layout: default
3
3
  ---
4
4
 
5
+ <link rel="icon" href="{{ '/assets/images/karnel-logo.png' | relative_url }}">
6
+ <meta name="description" content="Modular Dev Environment for Termux — install languages, databases, AI agents, editors, and more with one command.">
7
+ <meta property="og:title" content="Karnel Termux">
8
+ <meta property="og:description" content="Modular Dev Environment for Termux.">
9
+ <meta property="og:type" content="website">
10
+
5
11
  <nav class="site-nav" aria-label="Documentation">
6
12
  <a href="{{ '/' | relative_url }}">Docs</a>
7
13
  <a href="{{ '/cli/' | relative_url }}">CLI</a>
package/docs/cli/index.md CHANGED
@@ -39,7 +39,7 @@ karnel install <module> --tool1 --tool2 # Install specific tools only
39
39
  | `deploy` | Vercel, Railway, Netlify, Supabase CLIs |
40
40
  | `games` | Buzz, CTF God, Detective, Tamagotchi, Arcade, Pet Friends |
41
41
  | `network` | Dark Web OSINT, DedSec Network Toolkit |
42
- | `utils` | fconv, filecheck, notes, qrcode, SuperFile, zork, httptmux (12 scripts) |
42
+ | `utils` | fconv, filecheck, websites, notes, treex, passman, applaunch, splash, httptmux, zork, qrcode, superfile, herdr (13 scripts) |
43
43
  | `osint` | Robin v2.8 — dark web OSINT via Tor + LLM |
44
44
  | `voice` | Speech-to-agent via Termux:API |
45
45
  | `security`| Nmap, Hydra, SQLMap, Metasploit, and 26 other tools |
@@ -61,7 +61,7 @@ karnel install <module> --tool1 --tool2 # Install specific tools only
61
61
  | `deploy` | `--vercel`, `--railway`, `--netlify`, `--supabase` |
62
62
  | `games` | `--buzz`, `--ctfgod`, `--detective`, `--pet-friends`, `--tamagotchi`, `--arcade` |
63
63
  | `network` | `--dark`, `--dedsec-network` |
64
- | `utils` | `--fconv`, `--filecheck`, `--websites`, `--notes`, `--treex`, `--passman`, `--applaunch`, `--splash`, `--httptmux`, `--zork`, `--qrcode`, `--superfile` |
64
+ | `utils` | `--fconv`, `--filecheck`, `--websites`, `--notes`, `--treex`, `--passman`, `--applaunch`, `--splash`, `--httptmux`, `--zork`, `--qrcode`, `--superfile`, `--herdr` |
65
65
  | `security`| Run `karnel list security` for the 30 supported tool flags |
66
66
 
67
67
  ```bash
@@ -152,7 +152,7 @@ binary/command name, and current install status.
152
152
  | `deploy` | 4 deploy CLIs |
153
153
  | `games` | 6 games |
154
154
  | `network` | 2 network tools |
155
- | `utils` | 12 utility scripts |
155
+ | `utils` | 13 utility scripts |
156
156
  | `osint` | Robin OSINT |
157
157
  | `voice` | Voice commands |
158
158
  | `security`| 30 security tools |
@@ -288,7 +288,7 @@ Karnel, AI commands, shell config, processes, networking.
288
288
 
289
289
  ```bash
290
290
  karnel doctor code # Quick registry set (default)
291
- karnel doctor code --standard /path/to/project # + security, deps, coverage
291
+ karnel doctor code --standard /path/to/project # + security, deps, dead-code
292
292
  karnel doctor code --deep --json /path/to/project # All 76 definitions
293
293
  karnel doctor code --fix /path/to/project # Apply safe fixes
294
294
  ```
@@ -766,7 +766,7 @@ contain credentials. Protect local and cloud copies as sensitive plaintext data.
766
766
 
767
767
  | Flag | Description |
768
768
  |------|-------------|
769
- | `--cloud` | Legacy plaintext upload; requires explicit `KARNEL_ALLOW_PLAINTEXT_CLOUD_BACKUP=1` acknowledgement |
769
+ | `--cloud` | Upload to a configured rclone remote named `karnel` (e.g. Google Drive); archives are unencrypted at rest, so the `KARNEL_ALLOW_PLAINTEXT_CLOUD_BACKUP=1` acknowledgement is required |
770
770
  | `snapshot <name>` | Create a timestamped named snapshot using the same contents and secret filter as a full backup; names accept 1-64 letters, numbers, dots, underscores, or hyphens |
771
771
  | `list` / `ls` | List full backups and snapshots |
772
772
  | `info` / `show [file]` | Show a backup's contents (latest if omitted) |
@@ -817,7 +817,7 @@ Karnel if `apt-get` changes package state before returning an error.
817
817
  | Argument | Description |
818
818
  |----------|-------------|
819
819
  | `<file>` | Path to a specific backup file |
820
- | `--cloud` | Legacy unauthenticated cloud restore; requires `KARNEL_ALLOW_UNAUTHENTICATED_CLOUD_RESTORE=1` |
820
+ | `--cloud` | Restore from the rclone remote named `karnel`; a remote can replace both archive and checksum, so `KARNEL_ALLOW_UNAUTHENTICATED_CLOUD_RESTORE=1` is required to trust it |
821
821
  | `--list`, `-l` | List available full backups and snapshots |
822
822
  | `--help`, `-h` | Show help |
823
823
 
package/docs/index.md CHANGED
@@ -13,17 +13,25 @@ layout: base
13
13
  Karnel Termux transforms your Android device into a complete development workstation.
14
14
  With a single CLI (`karnel`), you can install and manage 45 AI tools, 3 editors,
15
15
  8 languages, 5 databases, 22 dev tools, 11 npm packages, 10 shell plugins,
16
- 4 UI components, 4 deploy CLIs, 6 games, 2 network tools, 12 utility tools,
16
+ 4 UI components, 4 deploy CLIs, 6 games, 2 network tools, 13 utility tools,
17
17
  30 security tools, 1 automation tool, responsible OSINT, a second brain,
18
18
  voice commands, and reviewed plugins — all from modules: `ai`, `auto`, `db`,
19
19
  `deploy`, `dev`, `editor`, `games`, `lang`, `network`, `npm`, `osint`,
20
20
  `security`, `shell`, `ui`, `utils`, `voice`, `plugin`.
21
21
 
22
+ ## 🌟 Featured: Herdr
23
+
24
+ Karnel now ships **[Herdr](https://herdr.dev)**, a terminal AI assistant CLI, as a managed utility.
25
+ Install it with `karnel install utils --herdr` — the binary is checksum-verified from the official
26
+ release manifest and tracked with Karnel ownership markers, so `karnel uninstall utils --herdr` is clean.
27
+ Open its docs with `karnel open herdr`.
28
+
22
29
  ## Sections
23
30
 
24
31
  <div class="karnel-links">
25
32
  <a href="./cli/">CLI Commands — full reference for every <code>karnel</code> subcommand</a>
26
33
  <a href="./doctor/">Doctor System — environment checks and the code-analysis engine</a>
34
+ <a href="./troubleshooting/">Troubleshooting — common issues and fixes</a>
27
35
  <a href="https://github.com/israelmarques1024-dotcom/karnel-termux/blob/main/karnel/tools/osint/robin/README.md">Robin OSINT — responsible use, lifecycle, data locations</a>
28
36
  <a href="https://github.com/israelmarques1024-dotcom/karnel-termux/blob/main/karnel/tools/network/dark/README.md">Network Tools — dark, dedsec-network</a>
29
37
  <a href="https://github.com/israelmarques1024-dotcom/karnel-termux/blob/main/karnel/tools/ai/keelcode/README.md">KeelCode — hosted coding-agent CLI</a>
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: Ai module
3
+ permalink: /karnel/ai/
4
+ layout: base
5
+ ---
6
+
7
+ # Ai module
8
+
9
+ AI coding agents and assistants (Claude Code, Codex, Cline, Goose, and many more).
10
+ ## Install
11
+
12
+ | `ai` | `--qwen-code`, `--gemini-cli`, `--claude-code`, `--mistral-vibe`, `--openclaude`, `--openclaw`, `--ollama`, `--codex`, `--opencode`, `--mimocode`, `--engram`, `--codegraph`, `--pi`, `--antigravity-cli`, `--minimax-cli`, `--gentle-ai`, `--gga`, `--hermes-agent`, `--kimi-code`, `--command-code`, `--codebuff`, `--freebuff`, `--kilocode-cli`, `--kiro`, `--crush`, `--cline`, `--odysseus`, `--kimchi-code`, `--omni-route`, `--ctx7`, `--openspec`, `--supercode-cli`, `--puter`, `--keelcode`, `--copilot-termux`, `--qoder`, `--ampcode`, `--cursor-cli`, `--oh-my-pi`, `--goose`, `--droid`, `--cactus`, `--cactus-needle`, `--walkie`, `--hugging-face` |
13
+
14
+ See the [CLI reference]({ '/cli/' | relative_url }#ai) for the full command list, or the
15
+ [source on GitHub](https://github.com/israelmarques1024-dotcom/karnel-termux/tree/main/karnel/modules/ai.sh).
16
+
17
+ [← Back to docs]({ '/' | relative_url })
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: Auto module
3
+ permalink: /karnel/auto/
4
+ layout: base
5
+ ---
6
+
7
+ # Auto module
8
+
9
+ Automation and workflow tooling (n8n).
10
+ ## Install
11
+
12
+ | `auto` | `--n8n` |
13
+
14
+ See the [CLI reference]({ '/cli/' | relative_url }#auto) for the full command list, or the
15
+ [source on GitHub](https://github.com/israelmarques1024-dotcom/karnel-termux/tree/main/karnel/modules/auto.sh).
16
+
17
+ [← Back to docs]({ '/' | relative_url })
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: Db module
3
+ permalink: /karnel/db/
4
+ layout: base
5
+ ---
6
+
7
+ # Db module
8
+
9
+ Databases such as PostgreSQL, MongoDB, Redis and companions.
10
+ ## Install
11
+
12
+ | `db` | `--postgresql`, `--mariadb`, `--sqlite`, `--mongodb`, `--redis` |
13
+
14
+ See the [CLI reference]({ '/cli/' | relative_url }#db) for the full command list, or the
15
+ [source on GitHub](https://github.com/israelmarques1024-dotcom/karnel-termux/tree/main/karnel/modules/db.sh).
16
+
17
+ [← Back to docs]({ '/' | relative_url })
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: Deploy module
3
+ permalink: /karnel/deploy/
4
+ layout: base
5
+ ---
6
+
7
+ # Deploy module
8
+
9
+ Deploy CLIs (Railway, Netlify, Vercel, Supabase).
10
+ ## Install
11
+
12
+ | `deploy` | `--vercel`, `--railway`, `--netlify`, `--supabase` |
13
+
14
+ See the [CLI reference]({ '/cli/' | relative_url }#deploy) for the full command list, or the
15
+ [source on GitHub](https://github.com/israelmarques1024-dotcom/karnel-termux/tree/main/karnel/modules/deploy.sh).
16
+
17
+ [← Back to docs]({ '/' | relative_url })
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: Dev module
3
+ permalink: /karnel/dev/
4
+ layout: base
5
+ ---
6
+
7
+ # Dev module
8
+
9
+ General development utilities (fzf, bat, make, proot-distro, tmux, and more).
10
+ ## Install
11
+
12
+ | `dev` | `--gh`, `--wget`, `--curl`, `--lsd`, `--bat`, `--proot`, `--ncurses`, `--tmate`, `--openssh`, `--tmux`, `--cloudflared`, `--translate`, `--html2text`, `--jq`, `--bc`, `--tree`, `--fzf`, `--imagemagick`, `--shfmt`, `--make`, `--udocker`, `--snyk` |
13
+
14
+ See the [CLI reference]({ '/cli/' | relative_url }#dev) for the full command list, or the
15
+ [source on GitHub](https://github.com/israelmarques1024-dotcom/karnel-termux/tree/main/karnel/modules/dev.sh).
16
+
17
+ [← Back to docs]({ '/' | relative_url })
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: Editor module
3
+ permalink: /karnel/editor/
4
+ layout: base
5
+ ---
6
+
7
+ # Editor module
8
+
9
+ Terminal and browser-based editors (code-server, Neovim, and more).
10
+ ## Install
11
+
12
+ | `editor` | `--code-server`, `--neovim`, `--nvchad` |
13
+
14
+ See the [CLI reference]({ '/cli/' | relative_url }#editor) for the full command list, or the
15
+ [source on GitHub](https://github.com/israelmarques1024-dotcom/karnel-termux/tree/main/karnel/modules/editor.sh).
16
+
17
+ [← Back to docs]({ '/' | relative_url })
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: Games module
3
+ permalink: /karnel/games/
4
+ layout: base
5
+ ---
6
+
7
+ # Games module
8
+
9
+ Terminal games to relax between sessions.
10
+ ## Install
11
+
12
+ | `games` | `--buzz`, `--ctfgod`, `--detective`, `--pet-friends`, `--tamagotchi`, `--arcade` |
13
+
14
+ See the [CLI reference]({ '/cli/' | relative_url }#games) for the full command list, or the
15
+ [source on GitHub](https://github.com/israelmarques1024-dotcom/karnel-termux/tree/main/karnel/modules/games.sh).
16
+
17
+ [← Back to docs]({ '/' | relative_url })
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: Lang module
3
+ permalink: /karnel/lang/
4
+ layout: base
5
+ ---
6
+
7
+ # Lang module
8
+
9
+ Programming-language runtimes (Python, Node.js, Rust, Go, and more).
10
+ ## Install
11
+
12
+ | `lang` | `--bun`, `--nodejs`, `--python`, `--perl`, `--php`, `--rust`, `--clang`, `--golang` |
13
+
14
+ See the [CLI reference]({ '/cli/' | relative_url }#lang) for the full command list, or the
15
+ [source on GitHub](https://github.com/israelmarques1024-dotcom/karnel-termux/tree/main/karnel/modules/lang.sh).
16
+
17
+ [← Back to docs]({ '/' | relative_url })
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: Network module
3
+ permalink: /karnel/network/
4
+ layout: base
5
+ ---
6
+
7
+ # Network module
8
+
9
+ Network utilities (dark, dedsec-network).
10
+ ## Install
11
+
12
+ | `network` | `--dark`, `--dedsec-network` |
13
+
14
+ See the [CLI reference]({ '/cli/' | relative_url }#network) for the full command list, or the
15
+ [source on GitHub](https://github.com/israelmarques1024-dotcom/karnel-termux/tree/main/karnel/modules/network.sh).
16
+
17
+ [← Back to docs]({ '/' | relative_url })
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: Npm module
3
+ permalink: /karnel/npm/
4
+ layout: base
5
+ ---
6
+
7
+ # Npm module
8
+
9
+ Node.js packages and JavaScript tooling.
10
+ ## Install
11
+
12
+ | `npm` | `--typescript`, `--nestjs`, `--prettier`, `--live-server`, `--localtunnel`, `--vercel`, `--markserv`, `--psqlformat`, `--ncu`, `--ngrok`, `--turbopack` |
13
+
14
+ See the [CLI reference]({ '/cli/' | relative_url }#npm) for the full command list, or the
15
+ [source on GitHub](https://github.com/israelmarques1024-dotcom/karnel-termux/tree/main/karnel/modules/npm.sh).
16
+
17
+ [← Back to docs]({ '/' | relative_url })
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: Osint module
3
+ permalink: /karnel/osint/
4
+ layout: base
5
+ ---
6
+
7
+ # Osint module
8
+
9
+ OSINT tooling, centered on Robin.
10
+ ## Install
11
+
12
+ | `osint` | Robin OSINT |
13
+
14
+ See the [CLI reference]({ '/cli/' | relative_url }#osint) for the full command list, or the
15
+ [source on GitHub](https://github.com/israelmarques1024-dotcom/karnel-termux/tree/main/karnel/modules/osint.sh).
16
+
17
+ [← Back to docs]({ '/' | relative_url })
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: Plugin module
3
+ permalink: /karnel/plugin/
4
+ layout: base
5
+ ---
6
+
7
+ # Plugin module
8
+
9
+ The plugin system and manager.
10
+ ## Install
11
+
12
+ | `plugin` | Plugin system |
13
+
14
+ See the [CLI reference]({ '/cli/' | relative_url }#plugin) for the full command list, or the
15
+ [source on GitHub](https://github.com/israelmarques1024-dotcom/karnel-termux/tree/main/karnel/modules/plugin.sh).
16
+
17
+ [← Back to docs]({ '/' | relative_url })
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: Security module
3
+ permalink: /karnel/security/
4
+ layout: base
5
+ ---
6
+
7
+ # Security module
8
+
9
+ Security and pentest tooling (30+ tools).
10
+ ## Install
11
+
12
+ | `security` | Security tools |
13
+
14
+ See the [CLI reference]({ '/cli/' | relative_url }#security) for the full command list, or the
15
+ [source on GitHub](https://github.com/israelmarques1024-dotcom/karnel-termux/tree/main/karnel/modules/security.sh).
16
+
17
+ [← Back to docs]({ '/' | relative_url })
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: Shell module
3
+ permalink: /karnel/shell/
4
+ layout: base
5
+ ---
6
+
7
+ # Shell module
8
+
9
+ Shell enhancements (ZSH, Oh My Zsh, zoxide).
10
+ ## Install
11
+
12
+ | `shell` | `--powerlevel10k`, `--zsh-defer`, `--zsh-autosuggestions`, `--zsh-syntax-highlighting`, `--history-substring`, `--zsh-completions`, `--fzf-tab`, `--you-should-use`, `--zsh-autopair`, `--better-npm` |
13
+
14
+ See the [CLI reference]({ '/cli/' | relative_url }#shell) for the full command list, or the
15
+ [source on GitHub](https://github.com/israelmarques1024-dotcom/karnel-termux/tree/main/karnel/modules/shell.sh).
16
+
17
+ [← Back to docs]({ '/' | relative_url })
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: Ui module
3
+ permalink: /karnel/ui/
4
+ layout: base
5
+ ---
6
+
7
+ # Ui module
8
+
9
+ Termux UI components.
10
+ ## Install
11
+
12
+ | `ui` | `--font`, `--extra-keys`, `--cursor`, `--banner` |
13
+
14
+ See the [CLI reference]({ '/cli/' | relative_url }#ui) for the full command list, or the
15
+ [source on GitHub](https://github.com/israelmarques1024-dotcom/karnel-termux/tree/main/karnel/modules/ui.sh).
16
+
17
+ [← Back to docs]({ '/' | relative_url })
@@ -0,0 +1,21 @@
1
+ ---
2
+ title: Utils module
3
+ permalink: /karnel/utils/
4
+ layout: base
5
+ ---
6
+
7
+ # Utils module
8
+
9
+ Utility scripts (converters, notes, QR codes, and more).
10
+ > **🌟 Herdr** — Karnel now ships the [Herdr](https://herdr.dev) terminal AI assistant CLI.
11
+ Install it with `karnel install utils --herdr`. The binary is checksum-verified, installed atomically,
12
+ and tracked with Karnel ownership markers so `karnel uninstall utils --herdr` is clean.
13
+
14
+ ## Install
15
+
16
+ | `utils` | `--fconv`, `--filecheck`, `--websites`, `--notes`, `--treex`, `--passman`, `--applaunch`, `--splash`, `--httptmux`, `--zork`, `--qrcode`, `--superfile`, `--herdr` |
17
+
18
+ See the [CLI reference]({ '/cli/' | relative_url }#utils) for the full command list, or the
19
+ [source on GitHub](https://github.com/israelmarques1024-dotcom/karnel-termux/tree/main/karnel/modules/utils.sh).
20
+
21
+ [← Back to docs]({ '/' | relative_url })
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: Voice module
3
+ permalink: /karnel/voice/
4
+ layout: base
5
+ ---
6
+
7
+ # Voice module
8
+
9
+ Voice commands for AI agents.
10
+ ## Install
11
+
12
+ | `voice` | Voice command |
13
+
14
+ See the [CLI reference]({ '/cli/' | relative_url }#voice) for the full command list, or the
15
+ [source on GitHub](https://github.com/israelmarques1024-dotcom/karnel-termux/tree/main/karnel/modules/voice.sh).
16
+
17
+ [← Back to docs]({ '/' | relative_url })
@@ -1 +1 @@
1
- ef2964062663afea85983ccb2043d0a8ab6e115e
1
+ 3d9d862c0be40df2c3f17648f56bf83ef74507b7
package/karnel/bin/karnel CHANGED
@@ -119,7 +119,7 @@ show_update_notification() {
119
119
  fi
120
120
  }
121
121
 
122
- if [[ "${KARNEL_READ_ONLY:-0}" != "1" ]] && [[ "${1:-}" != "update" ]] && [[ "${1:-}" != "uninstall" ]] && [[ "${1:-}" != "reinstall" ]]; then
122
+ if [[ "${KARNEL_READ_ONLY:-0}" != "1" ]] && [[ "${1:-}" != "update" ]] && [[ "${1:-}" != "uninstall" ]] && [[ "${1:-}" != "reinstall" ]] && [[ "${1:-}" != "upgrade" ]]; then
123
123
  check_for_updates
124
124
  import "@/utils/log"
125
125
  import "@/utils/colors"
@@ -126,6 +126,10 @@ _exec_apply_fix() {
126
126
  fi
127
127
 
128
128
  log_info "Applying fix: $tool ($lang)..."
129
+ # Snapshot the target before an in-place rewrite so the user can revert.
130
+ if [[ -n "$file" && -f "$file" && ! -e "$file.karnel-bak" ]]; then
131
+ cp -p "$file" "$file.karnel-bak" 2>/dev/null || true
132
+ fi
129
133
  local out rc
130
134
  if out=$(cd "$dir" && timeout 60 bash -c "$full_cmd" 2>&1); then
131
135
  rc=0
@@ -3,6 +3,7 @@
3
3
 
4
4
  import "@/utils/log"
5
5
  import "@/utils/colors"
6
+ import "@/utils/install"
6
7
 
7
8
  _fix_storage() {
8
9
  termux-setup-storage 2>/dev/null
@@ -207,7 +208,7 @@ _fix_psutil() {
207
208
  local tmp="$PREFIX/tmp/psutil_patch"
208
209
  mkdir -p "$tmp"
209
210
  pip download psutil==7.2.2 --no-binary :all: --no-deps -d "$tmp" 2>/dev/null || return 1
210
- tar xzf "$tmp/psutil-7.2.2.tar.gz" -C "$tmp"
211
+ safe_extract_tar "$tmp/psutil-7.2.2.tar.gz" "$tmp" || return 1
211
212
  if grep -q 'LINUX = sys.platform.startswith("linux")' "$tmp/psutil-7.2.2/psutil/_common.py" 2>/dev/null; then
212
213
  sed -i 's/LINUX = sys.platform.startswith("linux")/LINUX = sys.platform.startswith(("linux", "android"))/' "$tmp/psutil-7.2.2/psutil/_common.py"
213
214
  else
@@ -248,7 +249,18 @@ _fix_npm_shebangs() {
248
249
  }
249
250
 
250
251
  _fix_broken_symlinks() {
251
- find "$PREFIX/bin" -type l ! -exec test -e {} \; -delete 2>/dev/null
252
+ local link target
253
+ for link in "$PREFIX/bin"/*; do
254
+ [[ -L "$link" ]] || continue
255
+ [[ -e "$link" ]] && continue
256
+ target="$(readlink -f "$link" 2>/dev/null || true)"
257
+ # Only remove broken symlinks that point into Karnel-managed locations so we
258
+ # never delete unrelated third-party software from the user's environment.
259
+ if [[ "$target" == "$KARNEL_PATH"/* || "$target" == "$KARNEL_DATA"/* ||
260
+ "$target" == "$PREFIX/lib/node_modules"/* || "$target" == "$PREFIX/lib"/* ]]; then
261
+ rm -f "$link" 2>/dev/null || true
262
+ fi
263
+ done
252
264
  return 0
253
265
  }
254
266
 
@@ -1413,20 +1413,45 @@ doctor_termux() {
1413
1413
  fi
1414
1414
  if [[ "$confirm" == "y" ]]; then
1415
1415
  echo
1416
+ local -A DESTRUCTIVE_FIXES=(
1417
+ [_fix_ai_install]=1
1418
+ [_fix_proot_ubuntu]=1
1419
+ [_fix_disk_cleanup]=1
1420
+ [_fix_broken_symlinks]=1
1421
+ [_fix_apt_cache]=1
1422
+ )
1416
1423
  for ((i=0; i<${#fix_commands[@]}; i++)); do
1417
1424
  log_info "Fixing: ${fix_descriptions[$i]}..."
1418
1425
  local callback="${fix_callbacks[$i]:-}"
1419
1426
  local success=false
1420
-
1421
- if [[ -n "$callback" ]] && type "$callback" &>/dev/null 2>&1; then
1422
- "$callback" && success=true
1427
+ local apply_this="y"
1428
+
1429
+ # Destructive fixes are never auto-applied in --fix mode. In an
1430
+ # interactive --fix session they require an explicit confirmation; in a
1431
+ # non-interactive one they are skipped (fail-closed) to avoid wiping
1432
+ # caches, reinstalling packages or deleting unrelated software.
1433
+ if [[ -n "$callback" && -n "${DESTRUCTIVE_FIXES[$callback]:-}" ]]; then
1434
+ if $FIX_MODE; then
1435
+ if [[ -t 0 ]]; then
1436
+ read_confirm "DANGEROUS: ${fix_descriptions[$i]}. Apply?" apply_this
1437
+ else
1438
+ log_warn "Skipping destructive fix (non-interactive): ${fix_descriptions[$i]}"
1439
+ continue
1440
+ fi
1441
+ fi
1423
1442
  fi
1424
1443
 
1425
- if [[ "$success" == "true" ]]; then
1426
- ((fixed++))
1427
- log_success "Fixed: ${fix_descriptions[$i]}"
1428
- else
1429
- log_warn "Could not fix: ${fix_descriptions[$i]}"
1444
+ if [[ "$apply_this" == "y" ]]; then
1445
+ if [[ -n "$callback" ]] && type "$callback" &>/dev/null 2>&1; then
1446
+ "$callback" && success=true
1447
+ fi
1448
+
1449
+ if [[ "$success" == "true" ]]; then
1450
+ ((fixed++))
1451
+ log_success "Fixed: ${fix_descriptions[$i]}"
1452
+ else
1453
+ log_warn "Could not fix: ${fix_descriptions[$i]}"
1454
+ fi
1430
1455
  fi
1431
1456
  done
1432
1457
  echo
@@ -3,7 +3,7 @@
3
3
  import "@/utils/log"
4
4
  import "@/utils/colors"
5
5
 
6
- OPEN_BASE_URL="https://israelmarques1024-dotcom.github.io/karnel-termux"
6
+ OPEN_DOCS="https://israelmarques1024-dotcom.github.io/karnel-termux"
7
7
 
8
8
  open_main() {
9
9
  if [[ $# -eq 0 ]]; then
@@ -16,74 +16,30 @@ open_main() {
16
16
 
17
17
  case "$target" in
18
18
  karnel | help)
19
- url="$OPEN_BASE_URL/karnel"
19
+ url="$OPEN_DOCS/"
20
20
  ;;
21
- lang)
22
- url="$OPEN_BASE_URL/karnel/lang"
23
- ;;
24
- db)
25
- url="$OPEN_BASE_URL/karnel/db"
26
- ;;
27
- ai)
28
- url="$OPEN_BASE_URL/karnel/ai"
29
- ;;
30
- editor)
31
- url="$OPEN_BASE_URL/karnel/editor"
32
- ;;
33
- dev)
34
- url="$OPEN_BASE_URL/karnel/dev"
35
- ;;
36
- npm)
37
- url="$OPEN_BASE_URL/karnel/npm"
38
- ;;
39
- shell)
40
- url="$OPEN_BASE_URL/karnel/shell"
41
- ;;
42
- ui)
43
- url="$OPEN_BASE_URL/karnel/ui"
44
- ;;
45
- auto)
46
- url="$OPEN_BASE_URL/karnel/auto"
47
- ;;
48
- deploy)
49
- url="$OPEN_BASE_URL/karnel/deploy"
21
+ herdr)
22
+ url="$OPEN_DOCS/karnel/utils"
50
23
  ;;
51
24
  supabase)
52
- url="$OPEN_BASE_URL/karnel/supabase"
25
+ url="$OPEN_DOCS/karnel/deploy"
26
+ ;;
27
+ cleanup)
28
+ url="$OPEN_DOCS/cli"
53
29
  ;;
54
- cleanup)
55
- url="$OPEN_BASE_URL/karnel/cleanup"
56
- ;;
57
- network)
58
- url="$OPEN_BASE_URL/karnel/network"
59
- ;;
60
- utils)
61
- url="$OPEN_BASE_URL/karnel/utils"
62
- ;;
63
- games)
64
- url="$OPEN_BASE_URL/karnel/games"
65
- ;;
66
- voice)
67
- url="$OPEN_BASE_URL/karnel/voice"
68
- ;;
69
- plugin)
70
- url="$OPEN_BASE_URL/karnel/plugin"
71
- ;;
72
- security)
73
- url="$OPEN_BASE_URL/karnel/security"
74
- ;;
75
- osint|robin)
76
- url="$OPEN_BASE_URL/karnel/osint"
77
- ;;
78
- --help | -h)
30
+ --help | -h)
79
31
  open_help
80
32
  return
81
33
  ;;
82
34
  *)
83
- log_error "Unknown target: $target"
84
- echo
85
- open_help
86
- return 1
35
+ if [[ -f "$KARNEL_PATH/modules/$target.sh" ]]; then
36
+ url="$OPEN_DOCS/karnel/$target"
37
+ else
38
+ log_error "Unknown target: $target"
39
+ echo
40
+ open_help
41
+ return 1
42
+ fi
87
43
  ;;
88
44
  esac
89
45
 
@@ -130,20 +86,21 @@ open_help() {
130
86
  printf " ${D_GREEN}%-14s${NC} ${D_DIM}%s${NC}\n" "npm" "Node.js tools"
131
87
  printf " ${D_GREEN}%-14s${NC} ${D_DIM}%s${NC}\n" "shell" "ZSH shell"
132
88
  printf " ${D_GREEN}%-14s${NC} ${D_DIM}%s${NC}\n" "ui" "Termux UI"
133
- printf " ${D_GREEN}%-14s${NC} ${D_DIM}%s${NC}\n" "auto" "Automation tools"
134
- printf " ${D_GREEN}%-14s${NC} ${D_DIM}%s${NC}\n" "deploy" "Deploy CLIs"
135
- printf " ${D_GREEN}%-14s${NC} ${D_DIM}%s${NC}\n" "supabase" "Supabase CLI"
136
- printf " ${D_GREEN}%-14s${NC} ${D_DIM}%s${NC}\n" "games" "Games"
137
- printf " ${D_GREEN}%-14s${NC} ${D_DIM}%s${NC}\n" "cleanup" "Cache cleanup"
138
- printf " ${D_GREEN}%-14s${NC} ${D_DIM}%s${NC}\n" "network" "Network tools"
139
- printf " ${D_GREEN}%-14s${NC} ${D_DIM}%s${NC}\n" "utils" "Utility tools"
140
- printf " ${D_GREEN}%-14s${NC} ${D_DIM}%s${NC}\n" "voice" "Voice command"
141
- printf " ${D_GREEN}%-14s${NC} ${D_DIM}%s${NC}\n" "osint" "OSINT tools"
142
- printf " ${D_GREEN}%-14s${NC} ${D_DIM}%s${NC}\n" "plugin" "Plugin system"
143
- printf " ${D_GREEN}%-14s${NC} ${D_DIM}%s${NC}\n" "security" "Security tools"
144
- echo
89
+ printf " ${D_GREEN}%-14s${NC} ${D_DIM}%s${NC}\n" "auto" "Automation tools"
90
+ printf " ${D_GREEN}%-14s${NC} ${D_DIM}%s${NC}\n" "deploy" "Deploy CLIs"
91
+ printf " ${D_GREEN}%-14s${NC} ${D_DIM}%s${NC}\n" "supabase" "Supabase CLI"
92
+ printf " ${D_GREEN}%-14s${NC} ${D_DIM}%s${NC}\n" "games" "Games"
93
+ printf " ${D_GREEN}%-14s${NC} ${D_DIM}%s${NC}\n" "cleanup" "Cache cleanup"
94
+ printf " ${D_GREEN}%-14s${NC} ${D_DIM}%s${NC}\n" "network" "Network tools"
95
+ printf " ${D_GREEN}%-14s${NC} ${D_DIM}%s${NC}\n" "utils" "Utility tools"
96
+ printf " ${D_GREEN}%-14s${NC} ${D_DIM}%s${NC}\n" "voice" "Voice command"
97
+ printf " ${D_GREEN}%-14s${NC} ${D_DIM}%s${NC}\n" "osint" "OSINT tools"
98
+ printf " ${D_GREEN}%-14s${NC} ${D_DIM}%s${NC}\n" "plugin" "Plugin system"
99
+ printf " ${D_GREEN}%-14s${NC} ${D_DIM}%s${NC}\n" "security" "Security tools"
100
+ printf " ${D_GREEN}%-14s${NC} ${D_DIM}%s${NC}\n" "herdr" "Herdr terminal AI assistant"
101
+ echo
145
102
  separator_section "Website"
146
103
  echo
147
- list_item "${D_CYAN}$OPEN_BASE_URL${NC}"
104
+ list_item "${D_CYAN}$OPEN_DOCS${NC}"
148
105
  echo
149
106
  }
@@ -635,8 +635,11 @@ pg_restore_db() {
635
635
  success=true
636
636
  fi
637
637
  else
638
- if loading "Restoring database" pg_restore -d "$db_name" -c "$backup_file" 2>/dev/null || pg_restore -d "$db_name" "$backup_file" 2>/dev/null; then
638
+ local pg_log="$KARNEL_CACHE/pg-restore.log"
639
+ if loading "Restoring database" pg_restore -d "$db_name" -c --single-transaction "$backup_file" 2>>"$pg_log"; then
639
640
  success=true
641
+ else
642
+ log_warn "pg_restore failed; details in: $pg_log"
640
643
  fi
641
644
  fi
642
645
 
@@ -736,7 +739,8 @@ pg_schedule() {
736
739
 
737
740
  local escaped_db; printf -v escaped_db '%q' "$db_name"
738
741
  local escaped_path; printf -v escaped_path '%q' "$KARNEL_PATH"
739
- local job="$cron_expr KARNEL_PATH=$escaped_path $escaped_path/bin/karnel pg backup $escaped_db >/dev/null 2>&1"
742
+ local pg_log="$KARNEL_CACHE/pg-backup.log"
743
+ local job="$cron_expr PATH=\"$PREFIX/bin:/usr/bin:/bin\" PREFIX=\"$PREFIX\" KARNEL_PATH=$escaped_path $escaped_path/bin/karnel pg backup $escaped_db >>\"$pg_log\" 2>&1"
740
744
  local tmpcron
741
745
  tmpcron="$(mktemp "${TMPDIR:-${KARNEL_CACHE:-$HOME/.cache/karnel}}/karnel-pg.XXXXXX")" || {
742
746
  log_error "Failed to schedule backup for database '$db_name'"
@@ -32,7 +32,7 @@ install_oh_my_zsh() (
32
32
  echo
33
33
 
34
34
  local temp_base temp_dir temp_file
35
- temp_base="${TMPDIR:-${PREFIX:-/tmp}/tmp}"
35
+ temp_base="${TMPDIR:-${KARNEL_CACHE:-$HOME/.cache/karnel}}"
36
36
  mkdir -p "$temp_base" || return 1
37
37
  temp_dir=$(mktemp -d "$temp_base/karnel-omz.XXXXXX") || {
38
38
  log_error "Failed to create private Oh My Zsh temporary directory"
@@ -3,6 +3,7 @@
3
3
  import "@/utils/log"
4
4
  import "@/utils/colors"
5
5
  import "@/utils/version"
6
+ import "@/utils/install"
6
7
 
7
8
  : "${KARNEL_CACHE:=${XDG_CACHE_HOME:-$HOME/.cache}/karnel}"
8
9
  : "${KARNEL_DATA:=${XDG_DATA_HOME:-$HOME/.local/share}/karnel-data}"
@@ -142,7 +143,7 @@ _download_cursor_binary_impl() {
142
143
  return 1
143
144
  fi
144
145
 
145
- if ! tar -zxf "$staging_dir/$tarball" --strip-components=1 -C "$staging_dir" &>>"$LOG_FILE"; then
146
+ if ! safe_extract_tar "$staging_dir/$tarball" "$staging_dir" 1; then
146
147
  rm -rf "$staging_dir"
147
148
  log_error "Failed to extract Cursor CLI binary"
148
149
  return 1
@@ -41,7 +41,7 @@ _patch_psutil_for_termux() {
41
41
  local tmp
42
42
  tmp=$(mktemp -d "$KARNEL_CACHE/psutil_patch.XXXXXX") || return 1
43
43
  "$HERMES_VENV/bin/python" -m pip download psutil==7.2.2 --no-binary :all: --no-deps -d "$tmp" 2>/dev/null || { rm -rf "$tmp"; return 1; }
44
- tar xzf "$tmp/psutil-7.2.2.tar.gz" -C "$tmp" || { rm -rf "$tmp"; return 1; }
44
+ safe_extract_tar "$tmp/psutil-7.2.2.tar.gz" "$tmp" || { rm -rf "$tmp"; return 1; }
45
45
  sed -i 's/LINUX = sys.platform.startswith("linux")/LINUX = sys.platform.startswith(("linux", "android"))/' "$tmp/psutil-7.2.2/psutil/_common.py" || { rm -rf "$tmp"; return 1; }
46
46
  "$HERMES_VENV/bin/python" -m pip install "$tmp/psutil-7.2.2" || { rm -rf "$tmp"; return 1; }
47
47
  rm -rf "$tmp"
@@ -19,6 +19,7 @@ TOOLS_PACKAGES=(
19
19
  "zork"
20
20
  "qrcode"
21
21
  "superfile"
22
+ "herdr"
22
23
  )
23
24
 
24
25
  TOOLS_DISPLAY=(
@@ -34,6 +35,7 @@ TOOLS_DISPLAY=(
34
35
  "Zork (text adventure games I, II, III)"
35
36
  "QR Code (link-to-QR generator)"
36
37
  "SuperFile (terminal file manager)"
38
+ "Herdr (terminal AI assistant CLI)"
37
39
  )
38
40
 
39
41
  for _tool in "${TOOLS_PACKAGES[@]}"; do
@@ -0,0 +1,33 @@
1
+ # Herdr — terminal AI assistant
2
+
3
+ [Herdr](https://herdr.dev) is a fast terminal AI assistant CLI, distributed by the
4
+ Herdr project and integrated into Karnel Termux as a managed utility.
5
+
6
+ ## Install
7
+
8
+ ```bash
9
+ karnel install utils --herdr
10
+ ```
11
+
12
+ The installer:
13
+ - Resolves the latest release via the official manifest at `https://herdr.dev/latest.json`.
14
+ - Verifies the SHA-256 checksum before extracting.
15
+ - Installs atomically into `$PREFIX/bin/herdr` and writes a Karnel ownership marker
16
+ (`.karnel-wrapper-herdr`) so the binary is tracked.
17
+ - Honors `TMPDIR` / `KARNEL_CACHE` (never hardcodes `/tmp`, which is broken on Termux).
18
+
19
+ ## Uninstall / Update
20
+
21
+ ```bash
22
+ karnel uninstall utils --herdr # clean removal, only the managed binary
23
+ karnel update utils --herdr # re-fetch and re-verify latest release
24
+ ```
25
+
26
+ ## Usage
27
+
28
+ ```bash
29
+ herdr --help
30
+ herdr --version
31
+ ```
32
+
33
+ See https://herdr.dev for full documentation.
@@ -0,0 +1,160 @@
1
+ #!/usr/bin/env bash
2
+
3
+ import "@/utils/log"
4
+
5
+ HERDR_BIN="$PREFIX/bin/herdr"
6
+ HERDR_DATA_DIR="$KARNEL_DATA/herdr"
7
+ HERDR_MARKER="$HERDR_DATA_DIR/.karnel-managed"
8
+ HERDR_WRAPPER_MARKER="$HERDR_DATA_DIR/.karnel-wrapper-herdr"
9
+ HERDR_MANIFEST_URL="https://herdr.dev/latest.json"
10
+
11
+ _herdr_binary_owned() {
12
+ [[ -f "$HERDR_WRAPPER_MARKER" && -f "$HERDR_BIN" ]] || return 1
13
+ [[ "$(sha256sum "$HERDR_BIN" 2>/dev/null)" == "$(<"$HERDR_WRAPPER_MARKER")" ]]
14
+ }
15
+
16
+ _herdr_verify_ownership() {
17
+ if [[ -e "$HERDR_DATA_DIR" && ! -f "$HERDR_MARKER" ]]; then
18
+ log_error "Refusing to replace unowned data directory: $HERDR_DATA_DIR"
19
+ return 1
20
+ fi
21
+ if [[ -e "$HERDR_BIN" ]] && ! _herdr_binary_owned; then
22
+ log_error "Refusing to replace unowned command: $HERDR_BIN"
23
+ return 1
24
+ fi
25
+ }
26
+
27
+ _herdr_detect_target() {
28
+ local os arch
29
+ os="$(uname -s | tr '[:upper:]' '[:lower:]')"
30
+ [[ "$os" == "linux" ]] || {
31
+ log_error "Herdr supports Linux/macOS; this system reports: $os"
32
+ return 1
33
+ }
34
+ arch="$(uname -m)"
35
+ case "$arch" in
36
+ aarch64 | arm64) arch="aarch64" ;;
37
+ x86_64 | amd64) arch="x86_64" ;;
38
+ *) log_error "Unsupported architecture for Herdr: $arch"; return 1 ;;
39
+ esac
40
+ printf 'linux-%s' "$arch"
41
+ }
42
+
43
+ _herdr_resolve() {
44
+ local target="$1" manifest tmpf rc
45
+ manifest="$(curl -fsSL --retry 3 --connect-timeout 10 --max-time 20 "$HERDR_MANIFEST_URL" 2>/dev/null)" || return 1
46
+ tmpf="$(mktemp "${KARNEL_CACHE}/.herdr-manifest.XXXXXX")" || return 1
47
+ printf '%s' "$manifest" >"$tmpf"
48
+ python3 -c '
49
+ import sys, json
50
+ with open(sys.argv[1]) as fh:
51
+ data = json.load(fh)
52
+ target = sys.argv[2]
53
+ assets = data.get("assets", {})
54
+ sha = data.get("sha256", {})
55
+ url = assets.get(target)
56
+ digest = sha.get(target)
57
+ version = data.get("version")
58
+ if not url or not digest:
59
+ sys.exit(1)
60
+ print(url)
61
+ print(digest)
62
+ print(version or "")
63
+ ' "$tmpf" "$target"
64
+ rc=$?
65
+ rm -f "$tmpf"
66
+ return $rc
67
+ }
68
+
69
+ _herdr_download_and_install() {
70
+ local target="$1" info url sha version tmp actual temporary_bin
71
+
72
+ info="$(_herdr_resolve "$target")" || {
73
+ log_error "Failed to resolve the Herdr release for $target"
74
+ return 1
75
+ }
76
+ url="$(printf '%s' "$info" | sed -n '1p')"
77
+ sha="$(printf '%s' "$info" | sed -n '2p')"
78
+ version="$(printf '%s' "$info" | sed -n '3p')"
79
+
80
+ if [[ ! "$sha" =~ ^[0-9a-fA-F]{64}$ ]]; then
81
+ log_error "Herdr release manifest did not include a valid SHA-256 for $target"
82
+ return 1
83
+ fi
84
+ sha="${sha,,}"
85
+
86
+ mkdir -p "$KARNEL_DATA" "$PREFIX/bin" "${KARNEL_CACHE}" || return 1
87
+ _herdr_verify_ownership || return 1
88
+
89
+ tmp="$(mktemp -d "${KARNEL_CACHE}/.herdr.XXXXXX")" || return 1
90
+ if ! curl -fsSL --retry 3 --connect-timeout 10 --max-time 120 "$url" -o "$tmp/herdr"; then
91
+ rm -rf "$tmp"
92
+ log_error "Failed to download Herdr from $url"
93
+ return 1
94
+ fi
95
+
96
+ actual="$(sha256sum "$tmp/herdr" 2>/dev/null | awk '{print $1}')"
97
+ if [[ "$actual" != "$sha" ]]; then
98
+ rm -rf "$tmp"
99
+ log_error "Herdr checksum verification failed (expected $sha, got $actual)"
100
+ return 1
101
+ fi
102
+
103
+ temporary_bin="$(mktemp "$PREFIX/bin/.herdr.XXXXXX")" || { rm -rf "$tmp"; return 1; }
104
+ if ! install -m 755 "$tmp/herdr" "$temporary_bin" || ! mv -f "$temporary_bin" "$HERDR_BIN"; then
105
+ rm -f "$temporary_bin"
106
+ rm -rf "$tmp"
107
+ log_error "Failed to install the Herdr binary"
108
+ return 1
109
+ fi
110
+
111
+ mkdir -p "$HERDR_DATA_DIR" || return 1
112
+ sha256sum "$HERDR_BIN" >"$HERDR_WRAPPER_MARKER" || return 1
113
+ : >"$HERDR_MARKER"
114
+ rm -rf "$tmp"
115
+ }
116
+
117
+ install_herdr() {
118
+ if command -v herdr &>/dev/null; then
119
+ log_info "Herdr is already installed"
120
+ return 2
121
+ fi
122
+
123
+ local target
124
+ target="$(_herdr_detect_target)" || return 1
125
+
126
+ log_info "Installing Herdr..."
127
+ _herdr_download_and_install "$target" || return 1
128
+ log_success "Herdr installed"
129
+ }
130
+
131
+ uninstall_herdr() {
132
+ if [[ ! -e "$HERDR_BIN" && ! -d "$HERDR_DATA_DIR" ]]; then
133
+ log_info "Herdr is not installed"
134
+ return 2
135
+ fi
136
+
137
+ if _herdr_binary_owned && ! rm -f "$HERDR_BIN"; then
138
+ log_error "Failed to remove the Herdr command"
139
+ return 1
140
+ fi
141
+ if [[ -f "$HERDR_MARKER" ]] && ! rm -rf "$HERDR_DATA_DIR"; then
142
+ log_error "Failed to uninstall Herdr"
143
+ return 1
144
+ fi
145
+ log_success "Herdr uninstalled"
146
+ }
147
+
148
+ update_herdr() {
149
+ local target
150
+ target="$(_herdr_detect_target)" || return 1
151
+
152
+ log_info "Updating Herdr..."
153
+ _herdr_download_and_install "$target" || return 1
154
+ log_success "Herdr updated"
155
+ }
156
+
157
+ reinstall_herdr() {
158
+ uninstall_herdr || [[ $? -eq 2 ]] || return 1
159
+ install_herdr
160
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "karnel-termux",
3
- "version": "4.17.10",
3
+ "version": "4.17.13",
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"
@@ -46,5 +46,5 @@
46
46
  "bugs": {
47
47
  "url": "https://github.com/israelmarques1024-dotcom/karnel-termux/issues"
48
48
  },
49
- "homepage": "https://karneltermux.vercel.app"
49
+ "homepage": "https://israelmarques1024-dotcom.github.io/karnel-termux"
50
50
  }
@@ -20,7 +20,7 @@ _karnel_tool_flags() {
20
20
  security) tools="aircrack-ng amass binwalk burpsuite dirb dnsrecon enum4linux exiftool ffuf foremost gobuster hashcat hydra john masscan metasploit netcat nikto nmap smbclient sqlmap steghide subfinder tcpdump theharvester wafw00f whatweb whois wpscan zap" ;;
21
21
  shell) tools="powerlevel10k zsh-defer zsh-autosuggestions zsh-syntax-highlighting history-substring zsh-completions fzf-tab you-should-use zsh-autopair better-npm" ;;
22
22
  ui) tools="font extra-keys cursor banner" ;;
23
- utils) tools="fconv filecheck websites notes treex passman applaunch splash httptmux zork qrcode superfile" ;;
23
+ utils) tools="fconv filecheck websites notes treex passman applaunch splash httptmux zork qrcode superfile herdr" ;;
24
24
  esac
25
25
 
26
26
  local flags=""
@@ -82,7 +82,7 @@ _karnel_tool_flags() {
82
82
  security) tools="aircrack-ng amass binwalk burpsuite dirb dnsrecon enum4linux exiftool ffuf foremost gobuster hashcat hydra john masscan metasploit netcat nikto nmap smbclient sqlmap steghide subfinder tcpdump theharvester wafw00f whatweb whois wpscan zap" ;;
83
83
  shell) tools="powerlevel10k zsh-defer zsh-autosuggestions zsh-syntax-highlighting history-substring zsh-completions fzf-tab you-should-use zsh-autopair better-npm" ;;
84
84
  ui) tools="font extra-keys cursor banner" ;;
85
- utils) tools="fconv filecheck websites notes treex passman applaunch splash httptmux zork qrcode superfile" ;;
85
+ utils) tools="fconv filecheck websites notes treex passman applaunch splash httptmux zork qrcode superfile herdr" ;;
86
86
  esac
87
87
 
88
88
  local -a flags=()