karnel-termux 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +454 -0
- package/install.sh +272 -0
- package/karnel/bin/karnel +77 -0
- package/karnel/cli/commands/brain.sh +1553 -0
- package/karnel/cli/commands/cleanup.sh +66 -0
- package/karnel/cli/commands/doctor.sh +1528 -0
- package/karnel/cli/commands/env.sh +233 -0
- package/karnel/cli/commands/help.sh +8 -0
- package/karnel/cli/commands/ia.sh +502 -0
- package/karnel/cli/commands/init.sh +1274 -0
- package/karnel/cli/commands/install.sh +718 -0
- package/karnel/cli/commands/list.sh +399 -0
- package/karnel/cli/commands/open.sh +106 -0
- package/karnel/cli/commands/pg.sh +719 -0
- package/karnel/cli/commands/reinstall.sh +663 -0
- package/karnel/cli/commands/show.sh +90 -0
- package/karnel/cli/commands/start.sh +54 -0
- package/karnel/cli/commands/status.sh +96 -0
- package/karnel/cli/commands/uninstall.sh +668 -0
- package/karnel/cli/commands/update.sh +723 -0
- package/karnel/cli/commands/upgrade.sh +40 -0
- package/karnel/cli/commands/version.sh +3 -0
- package/karnel/cli/commands/voice.sh +230 -0
- package/karnel/cli/karnel.sh +706 -0
- package/karnel/modules/ai.sh +135 -0
- package/karnel/modules/auto.sh +114 -0
- package/karnel/modules/db.sh +132 -0
- package/karnel/modules/deploy.sh +74 -0
- package/karnel/modules/dev.sh +148 -0
- package/karnel/modules/editor.sh +115 -0
- package/karnel/modules/lang.sh +124 -0
- package/karnel/modules/npm.sh +146 -0
- package/karnel/modules/shell.sh +338 -0
- package/karnel/modules/ui.sh +139 -0
- package/karnel/modules/voice.sh +118 -0
- package/karnel/tools/ai/all.sh +209 -0
- package/karnel/tools/ai/antigravity-cli/README.md +45 -0
- package/karnel/tools/ai/antigravity-cli/bin/agy +28 -0
- package/karnel/tools/ai/antigravity-cli/helper/agy_helper.c +39 -0
- package/karnel/tools/ai/antigravity-cli/install.sh +469 -0
- package/karnel/tools/ai/claude-code/README.md +45 -0
- package/karnel/tools/ai/claude-code/bin/claude +29 -0
- package/karnel/tools/ai/claude-code/helper/claude_helper.c +42 -0
- package/karnel/tools/ai/claude-code/install.sh +278 -0
- package/karnel/tools/ai/cline/install.sh +160 -0
- package/karnel/tools/ai/codegraph/README.md +43 -0
- package/karnel/tools/ai/codegraph/bin/codegraph +5 -0
- package/karnel/tools/ai/codegraph/install.sh +160 -0
- package/karnel/tools/ai/codex/README.md +44 -0
- package/karnel/tools/ai/codex/install.sh +104 -0
- package/karnel/tools/ai/command-code/README.md +62 -0
- package/karnel/tools/ai/command-code/install.sh +136 -0
- package/karnel/tools/ai/crush/README.md +17 -0
- package/karnel/tools/ai/crush/install.sh +89 -0
- package/karnel/tools/ai/ctx7/README.md +26 -0
- package/karnel/tools/ai/ctx7/install.sh +61 -0
- package/karnel/tools/ai/engram/README.md +44 -0
- package/karnel/tools/ai/engram/install.sh +127 -0
- package/karnel/tools/ai/freebuff/README.md +52 -0
- package/karnel/tools/ai/freebuff/bin/freebuff +28 -0
- package/karnel/tools/ai/freebuff/helper/freebuff_helper.c +47 -0
- package/karnel/tools/ai/freebuff/install.sh +303 -0
- package/karnel/tools/ai/gemini-cli/README.md +46 -0
- package/karnel/tools/ai/gemini-cli/install.sh +111 -0
- package/karnel/tools/ai/gentle-ai/README.md +42 -0
- package/karnel/tools/ai/gentle-ai/install.sh +253 -0
- package/karnel/tools/ai/gentle-ai/termux-patches.go +256 -0
- package/karnel/tools/ai/gga/README.md +49 -0
- package/karnel/tools/ai/gga/install.sh +134 -0
- package/karnel/tools/ai/hermes-agent/README.md +50 -0
- package/karnel/tools/ai/hermes-agent/install.sh +120 -0
- package/karnel/tools/ai/kilocode-cli/README.md +45 -0
- package/karnel/tools/ai/kilocode-cli/bin/kilocode +21 -0
- package/karnel/tools/ai/kilocode-cli/helper/kilocode_helper.c +47 -0
- package/karnel/tools/ai/kilocode-cli/install.sh +179 -0
- package/karnel/tools/ai/kimchi-code/README.md +53 -0
- package/karnel/tools/ai/kimchi-code/install.sh +221 -0
- package/karnel/tools/ai/kimi-code/README.md +45 -0
- package/karnel/tools/ai/kimi-code/install.sh +111 -0
- package/karnel/tools/ai/kiro/README.md +17 -0
- package/karnel/tools/ai/kiro/install.sh +134 -0
- package/karnel/tools/ai/mimocode/README.md +43 -0
- package/karnel/tools/ai/mimocode/bin/mimo +28 -0
- package/karnel/tools/ai/mimocode/helper/mimocode_helper.c +47 -0
- package/karnel/tools/ai/mimocode/install.sh +287 -0
- package/karnel/tools/ai/minimax-cli/README.md +45 -0
- package/karnel/tools/ai/minimax-cli/install.sh +111 -0
- package/karnel/tools/ai/mistral-vibe/README.md +46 -0
- package/karnel/tools/ai/mistral-vibe/install.sh +119 -0
- package/karnel/tools/ai/odysseus/README.md +35 -0
- package/karnel/tools/ai/odysseus/install.sh +198 -0
- package/karnel/tools/ai/ollama/README.md +44 -0
- package/karnel/tools/ai/ollama/install.sh +78 -0
- package/karnel/tools/ai/omni-route/README.md +111 -0
- package/karnel/tools/ai/omni-route/install.sh +165 -0
- package/karnel/tools/ai/openclaude/README.md +46 -0
- package/karnel/tools/ai/openclaude/install.sh +110 -0
- package/karnel/tools/ai/openclaw/README.md +47 -0
- package/karnel/tools/ai/openclaw/install.sh +112 -0
- package/karnel/tools/ai/opencode/README.md +51 -0
- package/karnel/tools/ai/opencode/bin/opencode +28 -0
- package/karnel/tools/ai/opencode/helper/opencode_helper.c +57 -0
- package/karnel/tools/ai/opencode/install.sh +290 -0
- package/karnel/tools/ai/openspec/README.md +34 -0
- package/karnel/tools/ai/openspec/install.sh +61 -0
- package/karnel/tools/ai/pi/README.md +46 -0
- package/karnel/tools/ai/pi/install.sh +104 -0
- package/karnel/tools/ai/qwen-code/README.md +45 -0
- package/karnel/tools/ai/qwen-code/install.sh +111 -0
- package/karnel/tools/auto/all.sh +57 -0
- package/karnel/tools/auto/n8n/README.md +47 -0
- package/karnel/tools/auto/n8n/install.sh +102 -0
- package/karnel/tools/db/all.sh +61 -0
- package/karnel/tools/db/mariadb/README.md +43 -0
- package/karnel/tools/db/mariadb/install.sh +65 -0
- package/karnel/tools/db/mongodb/README.md +42 -0
- package/karnel/tools/db/mongodb/install.sh +73 -0
- package/karnel/tools/db/postgresql/README.md +45 -0
- package/karnel/tools/db/postgresql/install.sh +65 -0
- package/karnel/tools/db/redis/README.md +46 -0
- package/karnel/tools/db/redis/install.sh +64 -0
- package/karnel/tools/db/sqlite/README.md +44 -0
- package/karnel/tools/db/sqlite/install.sh +65 -0
- package/karnel/tools/deploy/all.sh +43 -0
- package/karnel/tools/deploy/netlify/install.sh +41 -0
- package/karnel/tools/deploy/railway/install.sh +109 -0
- package/karnel/tools/deploy/vercel/install.sh +43 -0
- package/karnel/tools/dev/all.sh +77 -0
- package/karnel/tools/dev/bat/README.md +44 -0
- package/karnel/tools/dev/bat/install.sh +82 -0
- package/karnel/tools/dev/bc/README.md +44 -0
- package/karnel/tools/dev/bc/install.sh +82 -0
- package/karnel/tools/dev/cloudflared/README.md +43 -0
- package/karnel/tools/dev/cloudflared/install.sh +82 -0
- package/karnel/tools/dev/curl/README.md +43 -0
- package/karnel/tools/dev/curl/install.sh +82 -0
- package/karnel/tools/dev/fzf/README.md +44 -0
- package/karnel/tools/dev/fzf/install.sh +82 -0
- package/karnel/tools/dev/gh/README.md +43 -0
- package/karnel/tools/dev/gh/install.sh +82 -0
- package/karnel/tools/dev/html2text/README.md +44 -0
- package/karnel/tools/dev/html2text/install.sh +82 -0
- package/karnel/tools/dev/imagemagick/README.md +44 -0
- package/karnel/tools/dev/imagemagick/install.sh +82 -0
- package/karnel/tools/dev/jq/README.md +44 -0
- package/karnel/tools/dev/jq/install.sh +82 -0
- package/karnel/tools/dev/lsd/README.md +44 -0
- package/karnel/tools/dev/lsd/install.sh +82 -0
- package/karnel/tools/dev/make/README.md +44 -0
- package/karnel/tools/dev/make/install.sh +82 -0
- package/karnel/tools/dev/ncurses/README.md +42 -0
- package/karnel/tools/dev/ncurses/install.sh +82 -0
- package/karnel/tools/dev/openssh/README.md +43 -0
- package/karnel/tools/dev/openssh/install.sh +75 -0
- package/karnel/tools/dev/proot/README.md +43 -0
- package/karnel/tools/dev/proot/install.sh +82 -0
- package/karnel/tools/dev/shfmt/README.md +44 -0
- package/karnel/tools/dev/shfmt/install.sh +82 -0
- package/karnel/tools/dev/tmate/README.md +44 -0
- package/karnel/tools/dev/tmate/install.sh +82 -0
- package/karnel/tools/dev/tmux/README.md +43 -0
- package/karnel/tools/dev/tmux/install.sh +75 -0
- package/karnel/tools/dev/translate/README.md +44 -0
- package/karnel/tools/dev/translate/install.sh +82 -0
- package/karnel/tools/dev/tree/README.md +44 -0
- package/karnel/tools/dev/tree/install.sh +82 -0
- package/karnel/tools/dev/udocker/README.md +44 -0
- package/karnel/tools/dev/udocker/install.sh +82 -0
- package/karnel/tools/dev/wget/README.md +44 -0
- package/karnel/tools/dev/wget/install.sh +82 -0
- package/karnel/tools/editor/all.sh +59 -0
- package/karnel/tools/editor/code-server/README.md +42 -0
- package/karnel/tools/editor/code-server/install.sh +74 -0
- package/karnel/tools/editor/neovim/README.md +43 -0
- package/karnel/tools/editor/neovim/install.sh +64 -0
- package/karnel/tools/editor/nvchad/README.md +45 -0
- package/karnel/tools/editor/nvchad/install.sh +105 -0
- package/karnel/tools/lang/all.sh +63 -0
- package/karnel/tools/lang/clang/README.md +43 -0
- package/karnel/tools/lang/clang/install.sh +79 -0
- package/karnel/tools/lang/golang/README.md +43 -0
- package/karnel/tools/lang/golang/install.sh +79 -0
- package/karnel/tools/lang/nodejs/README.md +43 -0
- package/karnel/tools/lang/nodejs/install.sh +79 -0
- package/karnel/tools/lang/perl/README.md +43 -0
- package/karnel/tools/lang/perl/install.sh +79 -0
- package/karnel/tools/lang/php/README.md +43 -0
- package/karnel/tools/lang/php/install.sh +79 -0
- package/karnel/tools/lang/python/README.md +43 -0
- package/karnel/tools/lang/python/install.sh +79 -0
- package/karnel/tools/lang/rust/README.md +43 -0
- package/karnel/tools/lang/rust/install.sh +79 -0
- package/karnel/tools/npm/all.sh +90 -0
- package/karnel/tools/npm/live-server/README.md +43 -0
- package/karnel/tools/npm/live-server/install.sh +96 -0
- package/karnel/tools/npm/localtunnel/README.md +43 -0
- package/karnel/tools/npm/localtunnel/install.sh +112 -0
- package/karnel/tools/npm/markserv/README.md +43 -0
- package/karnel/tools/npm/markserv/install.sh +95 -0
- package/karnel/tools/npm/ncu/README.md +43 -0
- package/karnel/tools/npm/ncu/install.sh +95 -0
- package/karnel/tools/npm/nestjs/README.md +43 -0
- package/karnel/tools/npm/nestjs/install.sh +95 -0
- package/karnel/tools/npm/ngrok/README.md +44 -0
- package/karnel/tools/npm/ngrok/install.sh +95 -0
- package/karnel/tools/npm/prettier/README.md +43 -0
- package/karnel/tools/npm/prettier/install.sh +95 -0
- package/karnel/tools/npm/psqlformat/README.md +43 -0
- package/karnel/tools/npm/psqlformat/install.sh +95 -0
- package/karnel/tools/npm/turbopack/README.md +8 -0
- package/karnel/tools/npm/turbopack/install.sh +42 -0
- package/karnel/tools/npm/typescript/README.md +43 -0
- package/karnel/tools/npm/typescript/install.sh +95 -0
- package/karnel/tools/npm/vercel/README.md +43 -0
- package/karnel/tools/npm/vercel/install.sh +95 -0
- package/karnel/tools/shell/all.sh +67 -0
- package/karnel/tools/shell/better-npm/README.md +43 -0
- package/karnel/tools/shell/better-npm/install.sh +85 -0
- package/karnel/tools/shell/fzf-tab/README.md +44 -0
- package/karnel/tools/shell/fzf-tab/install.sh +85 -0
- package/karnel/tools/shell/history-substring/README.md +43 -0
- package/karnel/tools/shell/history-substring/install.sh +85 -0
- package/karnel/tools/shell/powerlevel10k/README.md +43 -0
- package/karnel/tools/shell/powerlevel10k/install.sh +85 -0
- package/karnel/tools/shell/you-should-use/README.md +43 -0
- package/karnel/tools/shell/you-should-use/install.sh +85 -0
- package/karnel/tools/shell/zsh-autopair/README.md +44 -0
- package/karnel/tools/shell/zsh-autopair/install.sh +85 -0
- package/karnel/tools/shell/zsh-autosuggestions/README.md +43 -0
- package/karnel/tools/shell/zsh-autosuggestions/install.sh +85 -0
- package/karnel/tools/shell/zsh-completions/README.md +43 -0
- package/karnel/tools/shell/zsh-completions/install.sh +85 -0
- package/karnel/tools/shell/zsh-defer/README.md +43 -0
- package/karnel/tools/shell/zsh-defer/install.sh +85 -0
- package/karnel/tools/shell/zsh-syntax-highlighting/README.md +43 -0
- package/karnel/tools/shell/zsh-syntax-highlighting/install.sh +72 -0
- package/karnel/tools/ui/all.sh +61 -0
- package/karnel/tools/ui/banner/README.md +42 -0
- package/karnel/tools/ui/banner/install.sh +160 -0
- package/karnel/tools/ui/cursor/README.md +42 -0
- package/karnel/tools/ui/cursor/install.sh +58 -0
- package/karnel/tools/ui/extra-keys/README.md +43 -0
- package/karnel/tools/ui/extra-keys/install.sh +62 -0
- package/karnel/tools/ui/font/README.md +43 -0
- package/karnel/tools/ui/font/install.sh +63 -0
- package/karnel/tools/voice/all.sh +27 -0
- package/karnel/tools/voice/install.sh +10 -0
- package/karnel/tools/voice/uninstall.sh +8 -0
- package/karnel/utils/banner.sh +492 -0
- package/karnel/utils/bootstrap.sh +25 -0
- package/karnel/utils/colors.sh +33 -0
- package/karnel/utils/dialogrc +30 -0
- package/karnel/utils/env.sh +53 -0
- package/karnel/utils/log.sh +567 -0
- package/karnel/utils/version.sh +205 -0
- package/package.json +42 -0
- package/scripts/npm-install.js +60 -0
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# shellcheck disable=all
|
|
3
|
+
[[ -n "$ZSH_VERSION" ]] && emulate -L bash 2>/dev/null || true
|
|
4
|
+
# Note: deliberately NOT using set -e here — it leaks errexit to the parent
|
|
5
|
+
# shell, causing non-existent commands to exit zsh with code 127.
|
|
6
|
+
|
|
7
|
+
BANNER_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
8
|
+
BANNER_VERSION="$(grep "^KARNEL_VERSION=" "$BANNER_SCRIPT_DIR/env.sh" 2>/dev/null | cut -d'"' -f2)"
|
|
9
|
+
[[ -z "$BANNER_VERSION" ]] && BANNER_VERSION="1.0.0"
|
|
10
|
+
|
|
11
|
+
ESC=$(printf '\033')
|
|
12
|
+
BOLD="${ESC}[1m"
|
|
13
|
+
DIM="${ESC}[2m"
|
|
14
|
+
NC="${ESC}[0m"
|
|
15
|
+
# TrueColor helper (original gradient: red → purple → blue → black)
|
|
16
|
+
tc() { printf '%s[38;2;%d;%d;%dm' "$ESC" "$1" "$2" "$3"; }
|
|
17
|
+
|
|
18
|
+
WHITE=$(tc 255 255 255)
|
|
19
|
+
GRAY="${ESC}[0;90m"
|
|
20
|
+
|
|
21
|
+
# TP gradient: cyan → blue → purple → magenta (muted, original style)
|
|
22
|
+
TP=()
|
|
23
|
+
for i in $(seq 0 15); do
|
|
24
|
+
if (( i < 4 )); then
|
|
25
|
+
r=$(( 0 + i * 16 )); g=$(( 200 + i * 14 )); b=$(( 255 - i * 10 ))
|
|
26
|
+
elif (( i < 8 )); then
|
|
27
|
+
r=$(( 48 + (i-4) * 8 )); g=$(( 255 - (i-4) * 32 )); b=$(( 215 - (i-4) * 25 ))
|
|
28
|
+
elif (( i < 12 )); then
|
|
29
|
+
r=$(( 80 + (i-8) * 30 )); g=$(( 127 - (i-8) * 25 )); b=$(( 115 - (i-8) * 20 ))
|
|
30
|
+
else
|
|
31
|
+
r=$(( 200 + (i-12) * 14 )); g=$(( 27 + (i-12) * 5 )); b=$(( 35 + (i-12) * 20 ))
|
|
32
|
+
fi
|
|
33
|
+
(( r > 255 )) && r=255; (( g > 255 )) && g=255; (( b > 255 )) && b=255
|
|
34
|
+
(( r < 0 )) && r=0; (( g < 0 )) && g=0; (( b < 0 )) && b=0
|
|
35
|
+
TP+=("$(tc "$r" "$g" "$b")")
|
|
36
|
+
done
|
|
37
|
+
|
|
38
|
+
CYAN="${TP[0]}"
|
|
39
|
+
BLUE="${TP[4]}"
|
|
40
|
+
PURP="${TP[8]}"
|
|
41
|
+
MAG="${TP[12]}"
|
|
42
|
+
PINK=$(tc 255 80 140)
|
|
43
|
+
RED=$(tc 220 50 50)
|
|
44
|
+
RUBY=$(tc 220 50 60)
|
|
45
|
+
OBSIDIAN=$(tc 140 90 200)
|
|
46
|
+
GREEN1=$(tc 80 220 80)
|
|
47
|
+
GREEN2=$(tc 60 200 120)
|
|
48
|
+
C07="${TP[7]}"
|
|
49
|
+
C01="${TP[1]}"
|
|
50
|
+
C03="${TP[3]}"
|
|
51
|
+
C05="${TP[5]}"
|
|
52
|
+
C09="${TP[9]}"
|
|
53
|
+
C11="${TP[11]}"
|
|
54
|
+
C13="${TP[13]}"
|
|
55
|
+
|
|
56
|
+
# RK gradient: red → purple → blue → black (original)
|
|
57
|
+
RK=()
|
|
58
|
+
for _i in $(seq 0 15); do
|
|
59
|
+
if (( _i < 6 )); then
|
|
60
|
+
_r=$(( 255 - _i * 10 ))
|
|
61
|
+
_g=$(( 40 + _i * 22 ))
|
|
62
|
+
_b=$(( 40 + _i * 28 ))
|
|
63
|
+
elif (( _i < 11 )); then
|
|
64
|
+
_r=$(( 195 - (_i-6) * 30 ))
|
|
65
|
+
_g=$(( 172 - (_i-6) * 28 ))
|
|
66
|
+
_b=$(( 208 - (_i-6) * 15 ))
|
|
67
|
+
else
|
|
68
|
+
_r=$(( 45 - (_i-11) * 8 ))
|
|
69
|
+
_g=$(( 32 - (_i-11) * 6 ))
|
|
70
|
+
_b=$(( 133 - (_i-11) * 26 ))
|
|
71
|
+
fi
|
|
72
|
+
(( _r < 0 )) && _r=0; (( _g < 0 )) && _g=0; (( _b < 0 )) && _b=0
|
|
73
|
+
RK+=("$(tc "$_r" "$_g" "$_b")")
|
|
74
|
+
done
|
|
75
|
+
unset _i _r _g _b
|
|
76
|
+
|
|
77
|
+
# Metallic shine (pure gold → bright white gradient)
|
|
78
|
+
M_SHINE=$(tc 255 215 0)
|
|
79
|
+
M_GOLD=$(tc 255 200 50)
|
|
80
|
+
M_SILVER=$(tc 220 220 255)
|
|
81
|
+
|
|
82
|
+
_ansi_len() {
|
|
83
|
+
printf '%s' "$1" | sed 's/\x1b\[[0-9;]*m//g' | wc -m | tr -d ' '
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
_center() {
|
|
87
|
+
local text="$1" width="$2"
|
|
88
|
+
local vis; vis=$(_ansi_len "$text")
|
|
89
|
+
local total=$(( width - vis ))
|
|
90
|
+
local left=$(( total / 2 ))
|
|
91
|
+
local right=$(( total - left ))
|
|
92
|
+
printf '%*s' "$left" ''
|
|
93
|
+
printf '%s' "$text"
|
|
94
|
+
printf '%*s' "$right" ''
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
_repeat() {
|
|
98
|
+
local ch="$1" n="$2" out="" _z
|
|
99
|
+
for ((_z=0; _z<n; _z++)); do out+="$ch"; done
|
|
100
|
+
printf '%s' "$out"
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
# ================================================================
|
|
104
|
+
# Counters
|
|
105
|
+
# ================================================================
|
|
106
|
+
_count_ai() { local c=0; for cmd in opencode claude gemini codex qwen vibe mimo hermes kimi ollama freebuff agy mmx pi engram codegraph command-code gentle-ai gga openclaude openclaw kiro crush odysseus kilocode kimchi cline omni-route ctx7 openspec; do command -v "$cmd" &>/dev/null && ((c++)); done; echo "$c"; }
|
|
107
|
+
_count_lang() { local c=0; for cmd in node python python3 rustc go clang php perl; do command -v "$cmd" &>/dev/null && ((c++)); done; echo "$c"; }
|
|
108
|
+
_count_db() { local c=0; command -v pg_ctl &>/dev/null && ((c++)); command -v mariadb &>/dev/null && ((c++)); command -v sqlite3 &>/dev/null && ((c++)); command -v mongod &>/dev/null && ((c++)); echo "$c"; }
|
|
109
|
+
_uptime() {
|
|
110
|
+
if [[ -f /proc/uptime ]]; then
|
|
111
|
+
local secs; secs=$(awk '{print int($1)}' /proc/uptime 2>/dev/null)
|
|
112
|
+
local d=$((secs/86400)) h=$((secs%86400/3600)) m=$((secs%3600/60))
|
|
113
|
+
if (( d>0 )); then printf "%dd %dh" "$d" "$h"
|
|
114
|
+
elif (( h>0 )); then printf "%dh %dm" "$h" "$m"
|
|
115
|
+
else printf "%dm" "$m"; fi
|
|
116
|
+
else echo "?"; fi
|
|
117
|
+
}
|
|
118
|
+
_ram_free() {
|
|
119
|
+
if [[ -f /proc/meminfo ]]; then
|
|
120
|
+
local kb; kb=$(grep MemAvailable /proc/meminfo 2>/dev/null | awk '{print $2}')
|
|
121
|
+
[[ -n "$kb" ]] && echo "$((kb/1024))MB" || echo "?"
|
|
122
|
+
else echo "?"; fi
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
# ================================================================
|
|
126
|
+
# Figlet-generated text with red-black gradient
|
|
127
|
+
# ================================================================
|
|
128
|
+
FIGLET_TEXT=""
|
|
129
|
+
TERMUX_FIGLET_TEXT=""
|
|
130
|
+
FIGLET_LINES=()
|
|
131
|
+
TERMUX_FIGLET_LINES=()
|
|
132
|
+
if command -v figlet &>/dev/null; then
|
|
133
|
+
FIGLET_TEXT=$(figlet -f big "KARNEL" 2>/dev/null || true)
|
|
134
|
+
TERMUX_FIGLET_TEXT=$(figlet -f big "TERMUX" 2>/dev/null || true)
|
|
135
|
+
fi
|
|
136
|
+
if [[ -n "$FIGLET_TEXT" ]]; then
|
|
137
|
+
while IFS= read -r _fl; do FIGLET_LINES+=("$_fl"); done <<< "$FIGLET_TEXT"
|
|
138
|
+
fi
|
|
139
|
+
if [[ -n "$TERMUX_FIGLET_TEXT" ]]; then
|
|
140
|
+
while IFS= read -r _tl; do TERMUX_FIGLET_LINES+=("$_tl"); done <<< "$TERMUX_FIGLET_TEXT"
|
|
141
|
+
fi
|
|
142
|
+
|
|
143
|
+
# ================================================================
|
|
144
|
+
# Metallic shine — passes over the big figlet letters only
|
|
145
|
+
# ================================================================
|
|
146
|
+
_metallic_apply() {
|
|
147
|
+
local _text="$1" _base_color="$2" _scan="${3:-}"
|
|
148
|
+
local _trimmed="${_text#"${_text%%[! ]*}"}"
|
|
149
|
+
_trimmed="${_trimmed%"${_trimmed##*[! ]}"}"
|
|
150
|
+
local _text_len=${#_trimmed}
|
|
151
|
+
|
|
152
|
+
if (( _text_len < 4 )); then
|
|
153
|
+
echo "${_base_color}${_text}${NC}"
|
|
154
|
+
return
|
|
155
|
+
fi
|
|
156
|
+
|
|
157
|
+
local _lead="${_text%%[! ]*}"
|
|
158
|
+
local _lead_len=${#_lead}
|
|
159
|
+
local _center
|
|
160
|
+
if [[ -n "$_scan" ]]; then
|
|
161
|
+
_center=$(( _lead_len + _scan ))
|
|
162
|
+
else
|
|
163
|
+
_center=$(( _lead_len + _text_len / 2 ))
|
|
164
|
+
fi
|
|
165
|
+
|
|
166
|
+
local _core_r=$(( _text_len / 12 + 1 ))
|
|
167
|
+
local _halo_r=$(( _text_len / 7 + 2 ))
|
|
168
|
+
local _glow_r=$(( _text_len / 3 + 3 ))
|
|
169
|
+
|
|
170
|
+
local _out="" _i _char
|
|
171
|
+
for (( _i = 0; _i < ${#_text}; _i++ )); do
|
|
172
|
+
_char="${_text:_i:1}"
|
|
173
|
+
if [[ "$_char" == " " ]]; then
|
|
174
|
+
_out+=" "
|
|
175
|
+
else
|
|
176
|
+
local _dist=$(( _i > _center ? _i - _center : _center - _i ))
|
|
177
|
+
if (( _dist < _core_r )); then
|
|
178
|
+
_out+="${BOLD}${WHITE}${_char}"
|
|
179
|
+
elif (( _dist < _halo_r )); then
|
|
180
|
+
_out+="${BOLD}${M_GOLD}${_char}"
|
|
181
|
+
elif (( _dist < _glow_r )); then
|
|
182
|
+
_out+="${M_SHINE}${_char}"
|
|
183
|
+
else
|
|
184
|
+
_out+="${_base_color}${_char}"
|
|
185
|
+
fi
|
|
186
|
+
fi
|
|
187
|
+
done
|
|
188
|
+
_out+="${NC}"
|
|
189
|
+
echo "$_out"
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
# ================================================================
|
|
195
|
+
# Frame line (top / bottom) — pure TP gradient, no shine
|
|
196
|
+
# ================================================================
|
|
197
|
+
_render_frame_line() {
|
|
198
|
+
local _which="$1"
|
|
199
|
+
local cols="${COLUMNS:-$(tput cols 2>/dev/null || echo 80)}"
|
|
200
|
+
local W=$(( cols > 72 ? 68 : cols - 6 ))
|
|
201
|
+
(( W < 40 )) && W=40
|
|
202
|
+
local GAP_L=$(( (cols - W - 2) / 2 ))
|
|
203
|
+
(( GAP_L < 0 )) && GAP_L=0
|
|
204
|
+
local GAP_R=$(( cols - W - 2 - GAP_L ))
|
|
205
|
+
(( GAP_R < 0 )) && GAP_R=0
|
|
206
|
+
local pad_l; pad_l=$(printf '%*s' "$GAP_L" '')
|
|
207
|
+
local pad_r; pad_r=$(printf '%*s' "$GAP_R" '')
|
|
208
|
+
|
|
209
|
+
local p1 p2 p3
|
|
210
|
+
p1=$(( W / 4 )); p2=$(( W / 2 )); p3=$(( 3 * W / 4 ))
|
|
211
|
+
local frame="" i m_color
|
|
212
|
+
for (( i = 0; i < W; i++ )); do
|
|
213
|
+
local c_idx=$(( i * 16 / W ))
|
|
214
|
+
(( c_idx > 15 )) && c_idx=15
|
|
215
|
+
m_color="${TP[$c_idx]}"
|
|
216
|
+
if (( i == 1 || i == W-2 )); then
|
|
217
|
+
frame+="${m_color}╌${NC}"
|
|
218
|
+
elif (( i == p1 || i == p2 || i == p3 )); then
|
|
219
|
+
if [[ "$_which" == "top" ]]; then
|
|
220
|
+
frame+="${m_color}┬${NC}"
|
|
221
|
+
else
|
|
222
|
+
frame+="${m_color}┴${NC}"
|
|
223
|
+
fi
|
|
224
|
+
else
|
|
225
|
+
frame+="${m_color}─${NC}"
|
|
226
|
+
fi
|
|
227
|
+
done
|
|
228
|
+
|
|
229
|
+
if [[ "$_which" == "top" ]]; then
|
|
230
|
+
echo "${pad_l}${WHITE}╭${NC}${frame}${WHITE}╮${NC}${pad_r}"
|
|
231
|
+
else
|
|
232
|
+
echo "${pad_l}${WHITE}╰${NC}${frame}${WHITE}╯${NC}${pad_r}"
|
|
233
|
+
fi
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
# ================================================================
|
|
237
|
+
# Panel
|
|
238
|
+
# ================================================================
|
|
239
|
+
PANEL_HEADERS=("AI" "Lang" "DB" "Up" "RAM")
|
|
240
|
+
PANEL_ICONS=("◆" "</>" "⛁" "↗" "◫")
|
|
241
|
+
|
|
242
|
+
_panel_value() {
|
|
243
|
+
case $1 in
|
|
244
|
+
0) echo "${KAI_VAL:-$(_count_ai)}" ;;
|
|
245
|
+
1) echo "${KLANG_VAL:-$(_count_lang)}" ;;
|
|
246
|
+
2) echo "${KDB_VAL:-$(_count_db)}" ;;
|
|
247
|
+
3) echo "${KUP_VAL:-$(_uptime)}" ;;
|
|
248
|
+
4) echo "${KRAM_VAL:-$(_ram_free)}" ;;
|
|
249
|
+
esac
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
# ================================================================
|
|
253
|
+
# Render
|
|
254
|
+
# ================================================================
|
|
255
|
+
_render_top() {
|
|
256
|
+
local cols="${COLUMNS:-$(tput cols 2>/dev/null || echo 80)}"
|
|
257
|
+
local W=$(( cols > 72 ? 68 : cols - 6 ))
|
|
258
|
+
(( W < 40 )) && W=40
|
|
259
|
+
local GAP_L=$(( (cols - W - 2) / 2 ))
|
|
260
|
+
(( GAP_L < 0 )) && GAP_L=0
|
|
261
|
+
local GAP_R=$(( cols - W - 2 - GAP_L ))
|
|
262
|
+
(( GAP_R < 0 )) && GAP_R=0
|
|
263
|
+
local pad_l; pad_l=$(printf '%*s' "$GAP_L" '')
|
|
264
|
+
local pad_r; pad_r=$(printf '%*s' "$GAP_R" '')
|
|
265
|
+
local l_border="${TP[0]}" r_border="${TP[15]}"
|
|
266
|
+
local sp_line; sp_line=$(printf '%*s' "$W" '')
|
|
267
|
+
|
|
268
|
+
_render_frame_line "top"
|
|
269
|
+
local hdr="${TP[1]}┄${NC}${TP[1]}┄${NC} ${M_SHINE}◈${NC} ${BOLD}${WHITE}KARNEL${NC} ${WHITE}✦${NC} ${BOLD}${WHITE}SYSTEMS${NC} ${M_SHINE}◈${NC} ${TP[1]}┄${NC}${TP[1]}┄${NC}"
|
|
270
|
+
echo "${pad_l}${l_border}│${NC}$(_center "$hdr" "$W")${r_border}│${NC}${pad_r}"
|
|
271
|
+
echo "${pad_l}${l_border}│${NC}${sp_line}${r_border}│${NC}${pad_r}"
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
_render_figlet() {
|
|
275
|
+
local _anim_off="${1:-0}" _slow="${2:-}"
|
|
276
|
+
local cols="${COLUMNS:-$(tput cols 2>/dev/null || echo 80)}"
|
|
277
|
+
local W=$(( cols > 72 ? 68 : cols - 6 ))
|
|
278
|
+
(( W < 40 )) && W=40
|
|
279
|
+
local GAP_L=$(( (cols - W - 2) / 2 ))
|
|
280
|
+
(( GAP_L < 0 )) && GAP_L=0
|
|
281
|
+
local GAP_R=$(( cols - W - 2 - GAP_L ))
|
|
282
|
+
(( GAP_R < 0 )) && GAP_R=0
|
|
283
|
+
local pad_l; pad_l=$(printf '%*s' "$GAP_L" '')
|
|
284
|
+
local pad_r; pad_r=$(printf '%*s' "$GAP_R" '')
|
|
285
|
+
local l_border="${TP[0]}" r_border="${TP[15]}"
|
|
286
|
+
|
|
287
|
+
local num_fl=${#FIGLET_LINES[@]} num_tl=${#TERMUX_FIGLET_LINES[@]}
|
|
288
|
+
local _fi _ti _line _ci _colored _scan2 _fig_w=0 _fl2 _total_fig_lines=$(( num_fl + num_tl ))
|
|
289
|
+
for _fl2 in "${FIGLET_LINES[@]}"; do local _tl2=${#_fl2}; (( _tl2 > _fig_w )) && _fig_w=$_tl2; done
|
|
290
|
+
local _step=$(( (_fig_w + 16) * 1 / (_total_fig_lines > 1 ? _total_fig_lines - 1 : 1) ))
|
|
291
|
+
(( _step < 1 )) && _step=1
|
|
292
|
+
for (( _fi = 0; _fi < num_fl; _fi++ )); do
|
|
293
|
+
_line="${FIGLET_LINES[$_fi]}"
|
|
294
|
+
_ci=$(( _fi * 16 / (num_fl > 1 ? num_fl : 1) ))
|
|
295
|
+
(( _ci > 15 )) && _ci=15
|
|
296
|
+
_scan2=$(( -8 + _anim_off + _fi * _step ))
|
|
297
|
+
_colored=$(_metallic_apply "$_line" "${RK[$_ci]}" "$_scan2")
|
|
298
|
+
echo "${pad_l}${l_border}│${NC}$( _center "$_colored" "$W" )${r_border}│${NC}${pad_r}"
|
|
299
|
+
[[ -n "$_slow" ]] && sleep 0.2
|
|
300
|
+
done
|
|
301
|
+
for (( _ti = 0; _ti < num_tl; _ti++ )); do
|
|
302
|
+
_line="${TERMUX_FIGLET_LINES[$_ti]}"
|
|
303
|
+
_ci=$(( _ti * 16 / (num_tl > 1 ? num_tl : 1) ))
|
|
304
|
+
(( _ci > 15 )) && _ci=15
|
|
305
|
+
_scan2=$(( -8 + _anim_off + (_fi + _ti) * _step ))
|
|
306
|
+
_colored=$(_metallic_apply "$_line" "${RK[$_ci]}" "$_scan2")
|
|
307
|
+
echo "${pad_l}${l_border}│${NC}$( _center "$_colored" "$W" )${r_border}│${NC}${pad_r}"
|
|
308
|
+
[[ -n "$_slow" ]] && sleep 0.2
|
|
309
|
+
done
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
_render_bottom() {
|
|
313
|
+
local cols="${COLUMNS:-$(tput cols 2>/dev/null || echo 80)}"
|
|
314
|
+
local W=$(( cols > 72 ? 68 : cols - 6 ))
|
|
315
|
+
(( W < 40 )) && W=40
|
|
316
|
+
local GAP_L=$(( (cols - W - 2) / 2 ))
|
|
317
|
+
(( GAP_L < 0 )) && GAP_L=0
|
|
318
|
+
local GAP_R=$(( cols - W - 2 - GAP_L ))
|
|
319
|
+
(( GAP_R < 0 )) && GAP_R=0
|
|
320
|
+
local pad_l; pad_l=$(printf '%*s' "$GAP_L" '')
|
|
321
|
+
local pad_r; pad_r=$(printf '%*s' "$GAP_R" '')
|
|
322
|
+
local l_border="${TP[0]}" r_border="${TP[15]}"
|
|
323
|
+
local sp_line; sp_line=$(printf '%*s' "$W" '')
|
|
324
|
+
|
|
325
|
+
local div_total=$(( W - 2 ))
|
|
326
|
+
local div_l=$(( (div_total - 3) / 2 ))
|
|
327
|
+
local div_r=$(( div_total - 3 - div_l ))
|
|
328
|
+
local dash_l="" dash_r="" j
|
|
329
|
+
for (( j = 0; j < div_l; j++ )); do
|
|
330
|
+
local m=$(( j % 4 ))
|
|
331
|
+
if (( m == 0 )); then dash_l+="─"
|
|
332
|
+
elif (( m == 1 )); then dash_l+="┄"
|
|
333
|
+
elif (( m == 2 )); then dash_l+="·"
|
|
334
|
+
else dash_l+="─"; fi
|
|
335
|
+
done
|
|
336
|
+
for (( j = 0; j < div_r; j++ )); do
|
|
337
|
+
local m=$(( j % 4 ))
|
|
338
|
+
if (( m == 0 )); then dash_r+="─"
|
|
339
|
+
elif (( m == 1 )); then dash_r+="┄"
|
|
340
|
+
elif (( m == 2 )); then dash_r+="·"
|
|
341
|
+
else dash_r+="─"; fi
|
|
342
|
+
done
|
|
343
|
+
local div_line="${DIM}${dash_l}${NC}${TP[3]}◈${NC}${DIM}${dash_r}${NC}"
|
|
344
|
+
echo "${pad_l}${l_border}│${NC}$(_center "$div_line" "$W")${r_border}│${NC}${pad_r}"
|
|
345
|
+
|
|
346
|
+
local gem_line="${M_SHINE}◈${NC} ${BOLD}${RUBY}Dev${NC} ${WHITE}${BOLD}&${NC} ${BOLD}${OBSIDIAN}mobile${NC} ${M_SHINE}◈${NC}"
|
|
347
|
+
echo "${pad_l}${l_border}│${NC}$(_center "$gem_line" "$W")${r_border}│${NC}${pad_r}"
|
|
348
|
+
echo "${pad_l}${l_border}│${NC}$(_center "${GREEN2}${BOLD}Karnel${NC} ${GREEN1}v${BANNER_VERSION}${NC}" "$W")${r_border}│${NC}${pad_r}"
|
|
349
|
+
echo "${pad_l}${l_border}│${NC}$(_center "${DIM}by${NC} ${BOLD}${WHITE}israel${NC} ${WHITE}marques${NC}" "$W")${r_border}│${NC}${pad_r}"
|
|
350
|
+
echo "${pad_l}${l_border}│${NC}${sp_line}${r_border}│${NC}${pad_r}"
|
|
351
|
+
|
|
352
|
+
local PW=$(( W - 4 ))
|
|
353
|
+
(( PW < 20 )) && PW=20
|
|
354
|
+
local phline; phline=$(_repeat '─' "$PW")
|
|
355
|
+
|
|
356
|
+
echo "${pad_l}${l_border}│${NC} ${M_SHINE}╭${NC}${phline}${M_SHINE}╮${NC} ${r_border}│${NC}${pad_r}"
|
|
357
|
+
local ph=" ${M_SHINE}◈${NC} ${BOLD}${WHITE}STATUS${NC} ${M_SHINE}◈${NC} "
|
|
358
|
+
echo "${pad_l}${l_border}│${NC} ${M_SHINE}│${NC}$(_center "$ph" "$PW")${M_SHINE}│${NC} ${r_border}│${NC}${pad_r}"
|
|
359
|
+
|
|
360
|
+
local psep="" pj
|
|
361
|
+
for (( pj = 0; pj < PW; pj++ )); do
|
|
362
|
+
local m=$(( pj % 4 ))
|
|
363
|
+
if (( m == 0 )); then psep+="─"
|
|
364
|
+
elif (( m == 1 )); then psep+="┄"
|
|
365
|
+
elif (( m == 2 )); then psep+="·"
|
|
366
|
+
else psep+="─"; fi
|
|
367
|
+
done
|
|
368
|
+
echo "${pad_l}${l_border}│${NC} ${TP[3]}│${NC}${DIM}${psep}${NC}${TP[11]}│${NC} ${r_border}│${NC}${pad_r}"
|
|
369
|
+
|
|
370
|
+
local col_w=$(( (PW - 4) / 5 ))
|
|
371
|
+
local col_line=""
|
|
372
|
+
for (( i = 0; i < 5; i++ )); do
|
|
373
|
+
local val; val=$(_panel_value $i)
|
|
374
|
+
local entry="${TP[$(( i * 3 + 1 ))]}${PANEL_ICONS[$i]}${NC} ${BOLD}${WHITE}${PANEL_HEADERS[$i]}${NC} ${GREEN1}${val}${NC}"
|
|
375
|
+
local ev; ev=$(_ansi_len "$entry")
|
|
376
|
+
local epad=$(( (col_w - ev) / 2 ))
|
|
377
|
+
local epad2=$(( col_w - ev - epad ))
|
|
378
|
+
(( epad < 0 )) && epad=0
|
|
379
|
+
(( epad2 < 0 )) && epad2=0
|
|
380
|
+
col_line+="$(printf '%*s' "$epad" '')${entry}$(printf '%*s' "$epad2" '')"
|
|
381
|
+
(( i < 4 )) && col_line+="${GRAY}│${NC}"
|
|
382
|
+
done
|
|
383
|
+
echo "${pad_l}${l_border}│${NC} ${TP[3]}│${NC}${col_line}${TP[11]}│${NC} ${r_border}│${NC}${pad_r}"
|
|
384
|
+
echo "${pad_l}${l_border}│${NC} ${M_SHINE}╰${NC}${phline}${M_SHINE}╯${NC} ${r_border}│${NC}${pad_r}"
|
|
385
|
+
echo "${pad_l}${l_border}│${NC}${sp_line}${r_border}│${NC}${pad_r}"
|
|
386
|
+
|
|
387
|
+
local dot_line="" dj
|
|
388
|
+
for (( dj = 0; dj < W; dj++ )); do
|
|
389
|
+
if (( dj == W/2 )); then
|
|
390
|
+
dot_line+="${M_SHINE}◈${NC}"
|
|
391
|
+
elif (( dj % 4 == 0 )); then
|
|
392
|
+
dot_line+="${DIM}·${NC}"
|
|
393
|
+
elif (( dj % 3 == 1 )); then
|
|
394
|
+
dot_line+="${TP[$(( dj * 4 / W > 15 ? 15 : dj * 4 / W ))]}┄${NC}"
|
|
395
|
+
else
|
|
396
|
+
dot_line+="${DIM}─${NC}"
|
|
397
|
+
fi
|
|
398
|
+
done
|
|
399
|
+
echo "${pad_l}${l_border}│${NC}${dot_line}${r_border}│${NC}${pad_r}"
|
|
400
|
+
_render_frame_line "bot"
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
_render() {
|
|
404
|
+
_render_top
|
|
405
|
+
_render_figlet "" "${1:-}"
|
|
406
|
+
_render_bottom
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
_show_tip() {
|
|
410
|
+
local _tip_index_file="${XDG_CACHE_HOME:-$HOME/.cache}/karnel/.last_tip_index"
|
|
411
|
+
if [[ ${#KARNEL_TIPS[@]} -gt 0 ]]; then
|
|
412
|
+
local last_index=-1 new_index _tip
|
|
413
|
+
[[ -f "$_tip_index_file" ]] && last_index=$(cat "$_tip_index_file" 2>/dev/null || echo "-1")
|
|
414
|
+
new_index=$last_index
|
|
415
|
+
while [[ "$new_index" == "$last_index" ]]; do new_index=$(( RANDOM % ${#KARNEL_TIPS[@]} )); done
|
|
416
|
+
echo "$new_index" >"$_tip_index_file"
|
|
417
|
+
_tip="${KARNEL_TIPS[$new_index]:-}"
|
|
418
|
+
[[ -n "$_tip" ]] && { echo; log_tip "$_tip"; }
|
|
419
|
+
fi
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
_render_animated() {
|
|
423
|
+
_render_top
|
|
424
|
+
_render_figlet
|
|
425
|
+
_render_bottom
|
|
426
|
+
_show_tip
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
# Cache panel values so animation frames don't re-run system commands
|
|
430
|
+
KAI_VAL=$(_count_ai)
|
|
431
|
+
KLANG_VAL=$(_count_lang)
|
|
432
|
+
KDB_VAL=$(_count_db)
|
|
433
|
+
KUP_VAL=$(_uptime)
|
|
434
|
+
KRAM_VAL=$(_ram_free)
|
|
435
|
+
|
|
436
|
+
# Cache banner for clear() override (capture only, no terminal output)
|
|
437
|
+
_banner_output=$(_render 2>/dev/null) || true
|
|
438
|
+
_karnel_banner_cache="${XDG_CACHE_HOME:-$HOME/.cache}/karnel/banner_cache"
|
|
439
|
+
mkdir -p "$(dirname "$_karnel_banner_cache")" 2>/dev/null
|
|
440
|
+
[[ -t 1 ]] && echo "$_banner_output" > "$_karnel_banner_cache" 2>/dev/null
|
|
441
|
+
|
|
442
|
+
log_tip() { echo " ${TP[3]}●${NC} ${GRAY}Tip${NC} $*"; }
|
|
443
|
+
|
|
444
|
+
KARNEL_TIPS=(
|
|
445
|
+
"Keep Karnel updated: ${TP[3]}karnel update karnel${NC}"
|
|
446
|
+
"Check your version: ${TP[3]}karnel --version${NC}"
|
|
447
|
+
"Enable debug logs: ${TP[3]}export KARNEL_DEBUG=1${NC}"
|
|
448
|
+
"Open framework docs: ${TP[3]}karnel open karnel${NC}"
|
|
449
|
+
"Install everything: ${TP[3]}karnel install lang db dev npm${NC}"
|
|
450
|
+
"Install specific AI tools: ${TP[3]}karnel install ai --opencode --ollama${NC}"
|
|
451
|
+
"See what's installed: ${TP[3]}karnel list ai${NC}"
|
|
452
|
+
"Read tool docs: ${TP[3]}karnel show ai --opencode${NC}"
|
|
453
|
+
"Update a specific tool: ${TP[3]}karnel update ai --opencode${NC}"
|
|
454
|
+
"Update all AI tools: ${TP[3]}karnel update ai${NC}"
|
|
455
|
+
"Update all databases: ${TP[3]}karnel update db${NC}"
|
|
456
|
+
"Update ZSH plugins: ${TP[3]}karnel update shell${NC}"
|
|
457
|
+
"Remove a module: ${TP[3]}karnel uninstall npm${NC}"
|
|
458
|
+
"Install all languages: ${TP[3]}karnel install lang${NC}"
|
|
459
|
+
"Install Python: ${TP[3]}karnel install lang --python${NC}"
|
|
460
|
+
"Install Rust: ${TP[3]}karnel install lang --rust${NC}"
|
|
461
|
+
"Install Go: ${TP[3]}karnel install lang --golang${NC}"
|
|
462
|
+
"Start PostgreSQL: ${TP[3]}karnel pg init${NC} then ${TP[3]}karnel pg start${NC}"
|
|
463
|
+
"Open psql shell: ${TP[3]}karnel pg shell${NC}"
|
|
464
|
+
"Install all AI agents: ${TP[3]}karnel install ai${NC}"
|
|
465
|
+
"Install OpenCode: ${TP[3]}karnel install ai --opencode${NC}"
|
|
466
|
+
"Install Claude Code: ${TP[3]}karnel install ai --claude-code${NC}"
|
|
467
|
+
"Install Codex CLI: ${TP[3]}karnel install ai --codex${NC}"
|
|
468
|
+
"Install Gemini CLI: ${TP[3]}karnel install ai --gemini-cli${NC}"
|
|
469
|
+
"Install MiMo Code: ${TP[3]}karnel install ai --mimocode${NC}"
|
|
470
|
+
"Install code-server: ${TP[3]}karnel install editor${NC}"
|
|
471
|
+
"Fuzzy search: ${TP[3]}karnel install dev --fzf${NC}"
|
|
472
|
+
"Modern ls: ${TP[3]}karnel install dev --lsd${NC}"
|
|
473
|
+
"Syntax cat: ${TP[3]}karnel install dev --bat${NC}"
|
|
474
|
+
"GitHub CLI: ${TP[3]}karnel install dev --gh${NC}"
|
|
475
|
+
"Format shell scripts: ${TP[3]}karnel install dev --shfmt${NC}"
|
|
476
|
+
"Process JSON: ${TP[3]}karnel install dev --jq${NC}"
|
|
477
|
+
"Deploy to Vercel: ${TP[3]}karnel install npm --vercel${NC}"
|
|
478
|
+
"TypeScript: ${TP[3]}karnel install npm --typescript${NC}"
|
|
479
|
+
"Install ZSH + plugins: ${TP[3]}karnel install shell${NC}"
|
|
480
|
+
"Customize Termux UI: ${TP[3]}karnel install ui${NC}"
|
|
481
|
+
"Install banner: ${TP[3]}karnel install ui --banner${NC}"
|
|
482
|
+
"Set API keys: ${TP[3]}karnel env set${NC}"
|
|
483
|
+
"Second brain: ${TP[3]}karnel brain init${NC}"
|
|
484
|
+
"Save memories: ${TP[3]}karnel brain save${NC}"
|
|
485
|
+
"Voice-to-AI: ${TP[3]}karnel voice opencode${NC}"
|
|
486
|
+
"Init Next.js: ${TP[3]}cd my-app && karnel init next${NC}"
|
|
487
|
+
"Init Express: ${TP[3]}cd api && karnel init express${NC}"
|
|
488
|
+
)
|
|
489
|
+
|
|
490
|
+
_render_animated
|
|
491
|
+
|
|
492
|
+
echo
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# evitar redeclaraciones
|
|
4
|
+
[[ -n "${__KARNEL_BOOTSTRAP_LOADED:-}" ]] && return
|
|
5
|
+
__KARNEL_BOOTSTRAP_LOADED=1
|
|
6
|
+
|
|
7
|
+
# registro de imports
|
|
8
|
+
declare -A __KARNEL_IMPORTED
|
|
9
|
+
|
|
10
|
+
import() {
|
|
11
|
+
local base="${KARNEL_PATH}"
|
|
12
|
+
local path="${1//@/$base}.sh"
|
|
13
|
+
|
|
14
|
+
if [[ -n "${__KARNEL_IMPORTED[$path]}" ]]; then
|
|
15
|
+
return
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
if [[ ! -f "$path" ]]; then
|
|
19
|
+
echo "karnel: import error: $path not found" >&2
|
|
20
|
+
exit 1
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
__KARNEL_IMPORTED[$path]=1
|
|
24
|
+
source "$path"
|
|
25
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# light colors
|
|
4
|
+
GRAY="\033[0;90m"
|
|
5
|
+
GREEN="\e[1;32m"
|
|
6
|
+
CYAN="\e[1;36m" # Light Cyan
|
|
7
|
+
RED="\e[1;31m"
|
|
8
|
+
PURPLE="\e[1;35m"
|
|
9
|
+
YELLOW="\e[1;33m"
|
|
10
|
+
WHITE="\e[1;37m"
|
|
11
|
+
BLACK="\e[1;30m"
|
|
12
|
+
BLUE="\e[1;34m"
|
|
13
|
+
NC="\033[0m" # no color (reset)
|
|
14
|
+
|
|
15
|
+
# dark colors
|
|
16
|
+
D_DIM="\033[2m" # dim/subtle text
|
|
17
|
+
D_GREEN="\e[0;32m"
|
|
18
|
+
D_CYAN="\e[0;36m" # Dark Cyan
|
|
19
|
+
D_RED="\e[0;31m"
|
|
20
|
+
D_PURPLE="\e[0;35m"
|
|
21
|
+
D_YELLOW="\e[0;33m"
|
|
22
|
+
D_BLACK="\e[0;30m"
|
|
23
|
+
D_BLUE="\e[0;34m"
|
|
24
|
+
D_NC="\033[0m" # no color (reset) - dark variant
|
|
25
|
+
|
|
26
|
+
# background colors
|
|
27
|
+
BG_BLACK="\033[40m"
|
|
28
|
+
BG_BLUE="\033[44m"
|
|
29
|
+
BG_GREEN="\033[42m"
|
|
30
|
+
BG_CYAN="\033[46m"
|
|
31
|
+
BG_RED="\033[41m"
|
|
32
|
+
BG_YELLOW="\033[43m"
|
|
33
|
+
BG_WHITE="\033[47m"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
use_shadow = OFF
|
|
2
|
+
use_colors = ON
|
|
3
|
+
screen_color = (WHITE,BLACK,OFF)
|
|
4
|
+
dialog_color = (WHITE,BLACK,OFF)
|
|
5
|
+
title_color = (RED,BLACK,ON)
|
|
6
|
+
border_color = (MAGENTA,BLACK,OFF)
|
|
7
|
+
button_active_color = (WHITE,RED,ON)
|
|
8
|
+
button_inactive_color = (WHITE,BLACK,OFF)
|
|
9
|
+
button_key_active_color = (WHITE,RED,ON)
|
|
10
|
+
button_key_inactive_color = (RED,BLACK,OFF)
|
|
11
|
+
button_label_active_color = (YELLOW,RED,ON)
|
|
12
|
+
button_label_inactive_color = (WHITE,BLACK,ON)
|
|
13
|
+
inputbox_color = (WHITE,BLACK,OFF)
|
|
14
|
+
inputbox_border_color = (MAGENTA,BLACK,OFF)
|
|
15
|
+
searchbox_color = (WHITE,BLACK,OFF)
|
|
16
|
+
searchbox_title_color = (RED,BLACK,ON)
|
|
17
|
+
searchbox_border_color = (MAGENTA,BLACK,OFF)
|
|
18
|
+
position_indicator_color = (RED,BLACK,ON)
|
|
19
|
+
menubox_color = (WHITE,BLACK,OFF)
|
|
20
|
+
menubox_border_color = (MAGENTA,BLACK,OFF)
|
|
21
|
+
item_color = (WHITE,BLACK,OFF)
|
|
22
|
+
item_selected_color = (WHITE,MAGENTA,ON)
|
|
23
|
+
tag_color = (RED,BLACK,ON)
|
|
24
|
+
tag_selected_color = (WHITE,MAGENTA,ON)
|
|
25
|
+
tag_key_color = (RED,BLACK,OFF)
|
|
26
|
+
tag_key_selected_color = (WHITE,MAGENTA,ON)
|
|
27
|
+
check_color = (RED,BLACK,ON)
|
|
28
|
+
check_selected_color = (WHITE,MAGENTA,ON)
|
|
29
|
+
uarrow_color = (MAGENTA,BLACK,ON)
|
|
30
|
+
darrow_color = (MAGENTA,BLACK,ON)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
KARNEL_VERSION="4.7.4"
|
|
4
|
+
|
|
5
|
+
# -------------------------
|
|
6
|
+
# Directorios del usuario
|
|
7
|
+
# -------------------------
|
|
8
|
+
|
|
9
|
+
# configuración
|
|
10
|
+
KARNEL_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/karnel"
|
|
11
|
+
|
|
12
|
+
# cache
|
|
13
|
+
KARNEL_CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/karnel"
|
|
14
|
+
|
|
15
|
+
# datos del usuario
|
|
16
|
+
KARNEL_DATA="${XDG_DATA_HOME:-$HOME/.local/share}/karnel-data"
|
|
17
|
+
|
|
18
|
+
# -------------------------
|
|
19
|
+
# Rutas internas del CLI
|
|
20
|
+
# -------------------------
|
|
21
|
+
|
|
22
|
+
KARNEL_BIN="$KARNEL_PATH/bin"
|
|
23
|
+
KARNEL_MODULES="$KARNEL_PATH/modules"
|
|
24
|
+
KARNEL_UTILS="$KARNEL_PATH/utils"
|
|
25
|
+
KARNEL_CLI="$KARNEL_PATH/cli"
|
|
26
|
+
|
|
27
|
+
# -------------------------
|
|
28
|
+
# Crear directorios
|
|
29
|
+
# -------------------------
|
|
30
|
+
|
|
31
|
+
mkdir -p \
|
|
32
|
+
"$KARNEL_CONFIG" \
|
|
33
|
+
"$KARNEL_CACHE" \
|
|
34
|
+
"$KARNEL_DATA"
|
|
35
|
+
|
|
36
|
+
# -------------------------
|
|
37
|
+
# TUI Colors - Ruby & Obsidian
|
|
38
|
+
# -------------------------
|
|
39
|
+
[[ -f "$KARNEL_UTILS/dialogrc" ]] && export DIALOGRC="$KARNEL_UTILS/dialogrc"
|
|
40
|
+
export NEWT_COLORS='
|
|
41
|
+
root=,black
|
|
42
|
+
window=,black
|
|
43
|
+
border=magenta,black
|
|
44
|
+
textbox=white,black
|
|
45
|
+
button=white,red
|
|
46
|
+
actbutton=white,magenta
|
|
47
|
+
checkbox=magenta,black
|
|
48
|
+
actcheckbox=white,red
|
|
49
|
+
label=white,black
|
|
50
|
+
listbox=white,black
|
|
51
|
+
actlistbox=white,magenta
|
|
52
|
+
title=red,black
|
|
53
|
+
'
|